On Sun, Jan 13, 2019 at 10:18:06PM -0500, nevereturn01 wrote: Hi there,
> Since I'm not in the website develop team, I cannot let them change the url > structure:( That's a shame. Whether is easy (or even possible) to reverse-proxy the "site1" content at a different part of the url hierarchy is almost entirely down to the "site1" content. > Now, I'm tring to use URL rewrite. > I've tried the following: > ============================== > location /site1 { > rewrite ^/site1/(.*) /$1 break; > proxy_pass https://10.1.1.1; > ============================== > However, it didn't work and I got a Http 404 error. What one request did you make of nginx? What request did nginx make of the upstream server? What response came back? It is usually useful to test using "curl" rather than a full web browser, because it hides less from you. > If URL rewrite can help in this scenario, is there anything wrong with my > rewrite rule? You got a 404. I had suggested config without rewrite. Does that one help at all? (The main difference, I think, between rewrite and no-rewrite configs here, is the effective proxy_redirect config that applies. If you ask nginx for /site1/dir, nginx should ask upstream for /dir, and upstream will probably return 301 with a redirect to /dir/. With your config, your browser will get a redirect to /dir/, to which nginx will probably return 404. With my config, your browser should get a redirect to /site1/dir/, which has a chance of working.) f -- Francis Daly fran...@daoine.org _______________________________________________ nginx mailing list nginx@nginx.org http://mailman.nginx.org/mailman/listinfo/nginx