jetty.project icon indicating copy to clipboard operation
jetty.project copied to clipboard

Question: AbstractProxyServlet onServerResponseHeaders addHeader rather than setHeader

Open tongc opened this issue 8 years ago • 7 comments

We have a listener implmenets org.eclipse.jetty.client.api.Response.Listener class and for onHeaders method we have the following implementation

    @Override
    public void onHeaders(Response response) {
        wrappedVersion.onHeaders(response);
    }

this wrappedVersion.onHeaders calls ProxyResponseListener then calls AbstractProxyServlet's onServerResponseHeaders method which calls addHeader.

This is a problem for us because we have configured org.eclipse.jetty.servlets.CrossOriginFilter which has handleSimpleResponse which calls response.setHeader(ACCESS_CONTROL_ALLOW_ORIGIN_HEADER, origin);

And this CORS filter is called before our filter. Which means for our filter onHeaders, rather than replacing the headers, it actually added more headers.

I wonder why Jetty doesn't do setHeader in onServerResponseHeaders? I am guessing this is because we do not want to lose any set cookie headers? And what would be a better design if its something we can improve on our side?

thanks

tongc avatar May 18 '16 12:05 tongc

@sbordet old jetty-client API question.

joakime avatar Mar 22 '19 12:03 joakime

This issue has been automatically marked as stale because it has been a full year without activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Mar 21 '20 12:03 stale[bot]

This issue has been closed due to it having no activity.

stale[bot] avatar Apr 23 '20 04:04 stale[bot]

This issue has been automatically marked as stale because it has been a full year without activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Jun 02 '21 17:06 stale[bot]

This issue has been automatically marked as stale because it has been a full year without activity. It will be closed if no further activity occurs. Thank you for your contributions.

github-actions[bot] avatar Jun 06 '22 00:06 github-actions[bot]

This issue has been automatically marked as stale because it has been a full year without activity. It will be closed if no further activity occurs. Thank you for your contributions.

github-actions[bot] avatar Jun 16 '23 00:06 github-actions[bot]