I have the following setup:

server {
    server_name some.server;

    location / {
        rewrite ^ https://otherserver.com permanent;

The redirect works as expected, but the Authorization headers sent to the first request are not sent to the otherserver. How can I fix this?


HTTP authentication is domain-based, if the browser kept sending Authorization headers after a redirect to another domain then it would be leaking user credentials. If you need cross-domain authentication you should use some other technique.

  • That's mostly true, but you can put the base64-decoded (and subsequently URL-encoded) value of the Authorization header in the URL for the Location response header used for redirection. http://user:pass@example.com I just can't find a good way to do this conditionally in an Nginx config file. – Brad Sep 27 '14 at 3:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.