Expand my Community achievements bar.

SOLVED

"Content-Disposition" : "attachment" response header getting removed from dispatcher

Avatar

Level 2

We have written a servlet that allows user to download a .csv file from author. The servlet code is adding a response header "Content-Disposition" : "attachment".

When the servlet get request is submitted to author we are able to see the response header -- "Content-Disposition" : "attachment" on the browser.

We have  configured a dispatcher in front of author. When the same request is sent to via dispatcher, the response header "Content-Disposition" : "attachment"  is getting removed. We confirmed the missing header by verifying  the response headers on browser.

The missing response header is causing the downloaded file not to have any extension. Hence user is unable to open the .csv file on his machine as the extension is missing

Am I missing something in dispatcher configuration to allow this response header?

Apache version: 2.4

Dispatcher version: 4.1.12

1 Accepted Solution

Avatar

Correct answer by
Level 2

Hi Amitgupt,

Thank you for the information.

We are passing filename in the header.

This is the code in my servlet : response.setHeader("Content-Disposition", "attachment;filename=SearchResults.csv");

We have found the root cause of the issue. We have F5 load balancer which is in front of Dispatcher and has security rules that blocks the header  "Content-Disposition".

Dispatcher is behind the F5-Load balancer and user request hits dispatcher through F5-LB.

It is the LB which had security rules that blocked the "Content-Disposition" header at LB.

We fixed the security rules on F5-LB.

Issue is finally resolved.

Thanks,

Subramanya

View solution in original post

2 Replies

Avatar

Employee

are you sure that you are not seeing a cached response from dispatcher? if it is being cached then unless you configure dispatcher to cache headers also see Configuring Dispatcher "Caching HTTP Response Headers"

Also, just "Content-Disposition" : "attachment, does not set the filename. In the absence of filename in header, it will probably guess it from the url.

Avatar

Correct answer by
Level 2

Hi Amitgupt,

Thank you for the information.

We are passing filename in the header.

This is the code in my servlet : response.setHeader("Content-Disposition", "attachment;filename=SearchResults.csv");

We have found the root cause of the issue. We have F5 load balancer which is in front of Dispatcher and has security rules that blocks the header  "Content-Disposition".

Dispatcher is behind the F5-Load balancer and user request hits dispatcher through F5-LB.

It is the LB which had security rules that blocked the "Content-Disposition" header at LB.

We fixed the security rules on F5-LB.

Issue is finally resolved.

Thanks,

Subramanya