Closed rmja closed 8 years ago
One more thing. Cookies should also be forwarded. According to this post on StackOverflow, then I believe that the default WebRequestHandler
configuration should be:
handler.AllowAutoRedirect = false;
handler.UseCookies = false;
I can confirm that by setting handler.UseCookies = false
then the headers are forwarded as expected, instead of being silently removed.
Thanks for the suggestions. Agree that AllowAutoRedirect and UseCookies should be set to false. Since the extensibility of HttpClient allows to completely replace HttpMessageHandler, I just changed the settings in the default implementation. If users want to provide their own HttpMessageHandler, they will have to decide whether to change the two flags or not.
https://github.com/weidazhao/Hosting/commit/13cf06c375c7dddb9e3b969a785a5607dbc0e5af
@rmja @cwe1ss
The default behaviour in
HttpClient
is to auto follow 302 redirects, but I am not sure that it is the correct behaviour for the gateway. Instead the default should be to return the 302 to the caller. At least it should be configurable. Basically what is needed is to configure the message handler for the client, so that this becomes something like this instead: