Expand my Community achievements bar.

Learn about Edge Delivery Services in upcoming GEM session
SOLVED

Updating Response header after commit state

Avatar

Level 2

Hi team,

 

I'm basically looking to achieve some response header modification (e.g. "location" for redirect patterns etc.) But the problem is stated below.

DJSarkar_0-1656146676951.png

1.  Maximum response buffer size is set as 150 KB; But header section at few pages are writing more content in response which is causing the response to get committed in earlier state before component 1 is chained.

2. So, now if I need to update response headers based on certain result from component 1's REST call (to some remote platform); I'm unable to perform as the response is already committed and no further byte codes will be entertained.

 

So I'm trying to explore if there's any way this situation can be handled. Any help would be really great! Thanks!!

 

N.B. -  Some workarounds being tried:

1.  Chained filter in header component scope and try to execute component 1 logic there itself. But this does not seem so standard as i) additional REST call  ii) If trying to avoid extra REST call, then component 1 logic will be executed from Header scope, which is not good.

2. Increase Response buffer size, but that would negatively impact memory load (due to socket consumption)

3. Trying to reduce some redundant element from header but not sure if that'd always keep the resource size within the limit of buffer size.

1 Accepted Solution

Avatar

Correct answer by
Employee Advisor

No, this is not possible. When the response is flushed for the first time, it will send the HTTP response header first to the client. And this cannot be undone.

 

If you need to have this behavior, split your single request into multiple ones.

View solution in original post

1 Reply

Avatar

Correct answer by
Employee Advisor

No, this is not possible. When the response is flushed for the first time, it will send the HTTP response header first to the client. And this cannot be undone.

 

If you need to have this behavior, split your single request into multiple ones.