rewrite URL

Philipp Kraus philipp.kraus at tu-clausthal.de
Sat Jul 4 18:38:06 UTC 2015


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


More information about the nginx mailing list