Hi,

On Sat, Feb 9, 2019, at 19:50, Reiner Bühl wrote:
> Hi all,
> 
> I currently use the following location to redirect every request for a 
> resource under /webmail to a seperate server:
> 
>          location /webmail {
>                  rewrite ^/webmail(.*) /$1 break;
>                  proxy_pass http://127.0.0.1:8081;
>                  proxy_redirect off;
>                  proxy_set_header Host $host;
>          }
> 
> This works fine for URLs like /webmail/ or /webmail/<*>. However if the 
> URL is just /webmail - no trailing / - then the page itself is served 
> from the other web server but all resources like pictures that are 
> referenced in that page do not get rewriten. If I call the same page 
> with /webmail/, all resources in the page are properly rewritten and 
> load correctly.
> 
> Can you give me a hint what to change in the rule?
> 

The resources are probably in relative path and /webmail is different to 
/webmail/ - one has base path of / and the other is /webmail/. Request to 
css/app.css in first path resolves to /css/app.css and the other to 
/webmail/css/app.css.

I'd do a 301/302 redirect of /webmail to /webmail/ instead.
_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx

Reply via email to