The application I am working on works in a way where the request is sent from the browser to server A, server A makes some modifications to the request and forwards it to server B. Server B returns the response to server A which in turn returns it to the browser(Browser <=> Server A <=> Server B).
At server A I need to modify/remove a particular header "access-control-allow-origin" from the response given by server B. I can't do that at B where the response is created since I don't have access to the code. I need to do this at A itself.
I tried using the HttpServletResponseWrapper( How do delete a HTTP response header? ) but I think it is useful only when the headers are not set already. In my case the headers are set and need to be modified/removed.