3

I have the following issue.

After upgrading an application to ASP.NET 2.0 I get a 400 (bad request) status response whenever trying to authenticate in production.

This error does not reproduce locally and doesn't reproduce when using the production container locally.

The only difference that exists between production and local is that there is a reverse proxy in production that implements SSL for all requests.

I've tried moving the authentication code from middleware (as it was initially implemented) into a controller and I've changed the path to the route that was used for authentication. I still get the error.

All other requests work fine (provided you have a jwt token attached to them).

I should also mention that the CORS headers aren't set on the 400 response.

Any ideas?

2
  • Did you ever figure this out? I'm running into this as well, I CAN reproduce locally, but it's intermittent. Commented Jul 18, 2018 at 17:15
  • I am also running into this issue running an ASP.NET Core 2.2 webserver on a Raspberry Pi behind an nGinX reverse proxy with the following config : I jget a 400 response when hitting the login button. location / { proxy_pass http://localhost:5000; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "upgrade"; } Commented May 17, 2019 at 14:58

1 Answer 1

1

This issue was caused by an upstream reverse proxy that was stripping some headers from the requests. Requests with verbs Post & Put were affected.

Set the log level of your application to Information to see what Kestrel is actually complaining about.

In our case we had to switch hosting providers because of the issue.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.