3

I am trying to proxy pass in nginx. here is what the config looks like :

location /amazon {
        proxy_pass http://amazon.com;
    }

when I open domain.com/amazon it takes me to amazon.com/amazon. How should I write it so that is opens only amazon.com, without /amazon.

1 Answer 1

4

You can rewrite the URL to cut the /amazon prefix. Example:

location /amazon/ {
  rewrite /amazon/(.*) /$1 break;
  proxy_pass https://www.amazon.com;

  # bonus configuration for this particular host
  # may be irrelevant in your case
  proxy_set_header Host "www.amazon.com";
  proxy_ssl_server_name on;
}
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.