2

I would like to have requests to http://example.com/products/some-variable rewritten to http://catalog.example.com/some-variable without redirecting the user. In other words, the URL should not change.

I have found an example where something similar is done here, but I can't seem to figure out how to do the opposite.

Thanks in advance!

Community
  • 1
  • 1
Dennis Koster
  • 77
  • 1
  • 11

1 Answers1

3

I think in your case it would be something like this:

server {

  listen 80;
  server_name example.com;

  location ~ ^/products/(.*)$ {
    proxy_pass http://catalog.example.com/$1;
  }

}

Here is the article with proxy_pass examples:

http://www.liaohuqiu.net/posts/nginx-proxy-pass/

oakymax
  • 1,454
  • 1
  • 14
  • 21