Support #13930
openPath-Prefix Reverse Proxy with nginx
0%
Description
Is it possible to reverse proxy a Wt application on a path (HTTPD, not FastCGI) with nginx? Have an environment with a Wt httpd process running service an application. When locally viewing the application hosted on 127.0.0.1:8080, I can view the content fine with a local browser using the URL http://127.0.0.1:8080
. Looking to access the application behind a reverse proxy which can be accessible using a path such as "http://example.com/my-service/". In an attempt to support this, using an nginx configuration like the following:
location /my-service/ {
proxy_pass http://127.0.0.1:8080/;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Host $host;
proxy_set_header X-Forwarded-Proto $scheme;
}
And configured Wt with the following settings:
<trusted-proxy-config>
<original-ip-header>X-Forwarded-For</original-ip-header>
<trusted-proxies>
<proxy>127.0.0.1/8</proxy>
<proxy>::1/128</proxy>
</trusted-proxies>
</trusted-proxy-config>
The initial page appears to load through the reverse proxy, but resource links fail to work (e.g. JavaScript files cannot be served). Originally, I thought it was due to not include X-Forwarded-Prefix
in the reverse proxy configuration, but it does not appear to be used when inspecting Wt's code.
Visualization of the setup:
Is there any Wt-settings I may be overlooking?
Files
No data to display