Project

General

Profile

Actions

Support #13930

open

Path-Prefix Reverse Proxy with nginx

Added by James Knight 20 days ago.

Status:
New
Priority:
Normal
Assignee:
-
Target version:
-
Start date:
08/14/2025
Due date:
% Done:

0%

Estimated time:

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

clipboard-202508140046-ikheg.png (52.3 KB) clipboard-202508140046-ikheg.png James Knight, 08/14/2025 06:46 AM

No data to display

Actions

Also available in: Atom PDF