Nginx backslash not supported for proxy_pass (use as a reverse proxy)?

Viewed 21

I'm trying to host a 3rd party rather advanced Java app thru Wildfly using NGINX.

I've tried the following things (please check out the commented out config too)

location /app {
            proxy_set_header Host $host;
            proxy_set_header X-Real-IP $remote_addr;
            proxy_pass http://localhost:8080/app;
            proxy_redirect off;
            
            #rewrite ^/$uri $uri break;
            #rewrite ^/(.*)/$ /$1 permanent;
        }

        #location ^~ /app/*\\ {
        #    proxy_pass http://localhost:8080/app/*\\;
        #}

When I go to my hostname/app I can see the complicated Java Web App and login, but when it needs to load some documents it throws out the following XHR error (500 for this URL, but it's actually just 404):

https://example.org/app/app/resource/templateTree/\?count=200&orderBy=-1&orderDirectionAscending=false&fldrTime=-1&hash=53cdac085761b1a3fb5ba4535c8edf85e91c2f

How do I properly rewrite this URL with the backslash? That's exactly what I've tried in the config below, but failed miserably.

The server block itself is defined fine, just under location the rewriting should be added. When I run the application on localhost (without NGINX) I get the following URL in the XHR request, which succeeds:

http://10.0.2.4:8080/app/app/resource/document/home/%5C?count=200&orderBy=-1&orderDirectionAscending=false&fldrTime=0

proxy_pass http://localhost:8080/app$uri; doesn't work at all apparently :(

1 Answers

Wow, all I had to do was remove the /app in proxy_pass http://localhost:8080.

Case closed

bangs hammer

Related