Welcome! Log In Create A New Profile

Advanced

Re: rewrite URL

Constantine A. Murenin
July 04, 2015 02:56PM
On 2015-07-04 11:38, Philipp Kraus wrote:
> Hello,
>
> I try to use Nginx as a proxy (for SSL) on a Jetty server. The Jetty application should be accessed by a subdirectory of my Nginx. I have setup this location configuration:
>
> location /myapp {
>
> proxy_pass http://localhost:8112;
>
> proxy_set_header X-Forwarded-Host $http_host;
> proxy_set_header X-Forwarded-Proto $scheme;
> #proxy_set_header X-Real-IP $remote_addr;
> proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
> proxy_http_version 1.1;
> proxy_set_header Upgrade $http_upgrade;
> proxy_set_header Connection "upgrade";
> client_max_body_size 650M;
>
> }
>
> The Jetty server runs under http://localhost:8112, if I change the „location /myapp“ to „location /„ everything works fine. The Jetty server returns URLs with the base URL /, so on this configuration CSS / JSS files are not found.
> How can I rewrite the URLs, so that all files are found within the directory /myapp ?
>
> Thanks
>
> Phil

Hi Phil,

You should specify a URI (e.g., a trailing slash) in the URL specified
by the proxy_pass directive:

> location /myapp {
>
> proxy_pass http://localhost:8112/;
....

See http://nginx.org/r/proxy_pass for more info.

Cheers,
Constantine.

_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Subject Author Posted

rewrite URL

Philipp Kraus July 04, 2015 02:40PM

Re: rewrite URL

Constantine A. Murenin July 04, 2015 02:56PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 78
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready