[GH-ISSUE #152] pgbackweb issue behind proxy #123

Open
opened 2026-02-26 21:34:32 +03:00 by kerem · 2 comments
Owner

Originally created by @vcornil on GitHub (Nov 13, 2025).
Original GitHub issue: https://github.com/eduardolat/pgbackweb/issues/152

I'm using the environment variable:
PBW_PATH_PREFIX: /pgbackweb

It works correctly accessing it directly via the IP, like http://192.168.1.123:8085/pgbackweb

But I can't figure out how to make it working behind a proxy to expose it on my public domain like https://on.mydomain.com/
I put in nginx something like :

location = /pgbackweb {
return 301 https://$host:$server_port/pgbackweb/;
}
location = /pgbackweb/ {
proxy_pass http://192.168.1.123:8085/pgbackweb;
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}

But all I get then is:
{"message":"Not Found"}

And in the pgbackweb nginx log:

172.28.0.1 - - [13/Nov/2025:15:50:44 +0000] "GET /pgbackweb/auth/login HTTP/1.1" 404 40 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/142.0.0.0 Safari/537.36 Edg/142.0.0.0" "-"

2025/11/13 15:50:44 [error] 25#25: *11 connect() failed (111: Connection refused) while connecting to upstream, client: 172.28.0.1, server: _, request: "GET /favicon.ico HTTP/1.1", upstream: "http://192.168.1.123:8443/favicon.ico", host: "on.mydomain.com:8443", referrer: "https://on.mydomain.com:8443/pgbackweb/auth/login"

.1 - - [13/Nov/2025:15:50:44 +0000] "GET /favicon.ico HTTP/1.1" 502 552 "https://on.mydomain.com:8443/pgbackweb/auth/login" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/142.0.0.0 Safari/537.36 Edg/142.0.0.0" "-"

(for the 2 latest one, I assume it is just the PBW_PATH_PREFIX no applied on the favicon.ico and not really important - but the first one is a 404 on /pgbackweb/auth/login

Any idea what could fix this issue?

I tried various setting without succes, like:

location /pgbackweb/ {
    proxy_pass http://192.168.1.123:8085/pgbackweb;
    proxy_set_header Host $host:$server_port;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header X-Forwarded-Proto $scheme;
    proxy_set_header X-Forwarded-Host $host;

    proxy_redirect off;  # Disable automatic redirect rewriting

    # WebSocket support (needed for admin console)
    proxy_http_version 1.1;
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection "upgrade";

    # Buffering settings
    proxy_buffering off;
    proxy_buffer_size 128k;
    proxy_buffers 4 256k;
    proxy_busy_buffers_size 256k;

    # Override CSP to allow framing
    # Hide backend CSP and add our own
    proxy_hide_header Content-Security-Policy;
    add_header Content-Security-Policy "frame-src 'self' https://$host:$server_port https://$host; frame-ancestors 'self' https://$host:$server_port https://$host;" always;
    add_header Access-Control-Allow-Origin "https://$host:$server_port";
    add_header Access-Control-Allow-Methods "GET, POST, OPTIONS";
    add_header Access-Control-Allow-Headers "Authorization, Content-Type";
    add_header Access-Control-Allow-Credentials "true" always;

}
Originally created by @vcornil on GitHub (Nov 13, 2025). Original GitHub issue: https://github.com/eduardolat/pgbackweb/issues/152 I'm using the environment variable: PBW_PATH_PREFIX: /pgbackweb It works correctly accessing it directly via the IP, like http://192.168.1.123:8085/pgbackweb But I can't figure out how to make it working behind a proxy to expose it on my public domain like https://on.mydomain.com/ I put in nginx something like : ``` location = /pgbackweb { return 301 https://$host:$server_port/pgbackweb/; } location = /pgbackweb/ { proxy_pass http://192.168.1.123:8085/pgbackweb; proxy_set_header Host $http_host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Proto $scheme; } ``` But all I get then is: {"message":"Not Found"} And in the pgbackweb nginx log: ``` 172.28.0.1 - - [13/Nov/2025:15:50:44 +0000] "GET /pgbackweb/auth/login HTTP/1.1" 404 40 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/142.0.0.0 Safari/537.36 Edg/142.0.0.0" "-" 2025/11/13 15:50:44 [error] 25#25: *11 connect() failed (111: Connection refused) while connecting to upstream, client: 172.28.0.1, server: _, request: "GET /favicon.ico HTTP/1.1", upstream: "http://192.168.1.123:8443/favicon.ico", host: "on.mydomain.com:8443", referrer: "https://on.mydomain.com:8443/pgbackweb/auth/login" .1 - - [13/Nov/2025:15:50:44 +0000] "GET /favicon.ico HTTP/1.1" 502 552 "https://on.mydomain.com:8443/pgbackweb/auth/login" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/142.0.0.0 Safari/537.36 Edg/142.0.0.0" "-" ``` (for the 2 latest one, I assume it is just the PBW_PATH_PREFIX no applied on the favicon.ico and not really important - but the first one is a 404 on /pgbackweb/auth/login Any idea what could fix this issue? I tried various setting without succes, like: ``` location /pgbackweb/ { proxy_pass http://192.168.1.123:8085/pgbackweb; proxy_set_header Host $host:$server_port; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Proto $scheme; proxy_set_header X-Forwarded-Host $host; proxy_redirect off; # Disable automatic redirect rewriting # WebSocket support (needed for admin console) proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "upgrade"; # Buffering settings proxy_buffering off; proxy_buffer_size 128k; proxy_buffers 4 256k; proxy_busy_buffers_size 256k; # Override CSP to allow framing # Hide backend CSP and add our own proxy_hide_header Content-Security-Policy; add_header Content-Security-Policy "frame-src 'self' https://$host:$server_port https://$host; frame-ancestors 'self' https://$host:$server_port https://$host;" always; add_header Access-Control-Allow-Origin "https://$host:$server_port"; add_header Access-Control-Allow-Methods "GET, POST, OPTIONS"; add_header Access-Control-Allow-Headers "Authorization, Content-Type"; add_header Access-Control-Allow-Credentials "true" always; } ```
Author
Owner

@xbreaker commented on GitHub (Jan 16, 2026):

Same here. Used traefik to proxy service

  pgbackweb:
    image: eduardolat/pgbackweb:0.5.1
    container_name: pgbackweb
    environment:
      ...
      PBW_PATH_PREFIX: /pgbackweb
    labels:
      - "traefik.enable=true"
      - "traefik.http.routers.pgbackweb.rule=PathPrefix(`/pgbackweb`)"
      - "traefik.http.routers.pgbackweb.entrypoints=web"
      - "traefik.http.services.pgbackweb.loadbalancer.server.port=8085"
      - "traefik.http.middlewares.pgbackweb-stripprefix.stripprefix.prefixes=/pgbackweb"
      - "traefik.http.routers.pgbackweb.middlewares=pgbackweb-stripprefix"
    restart: unless-stopped

Answer the same: {"message":"Not Found"}

<!-- gh-comment-id:3759524615 --> @xbreaker commented on GitHub (Jan 16, 2026): Same here. Used traefik to proxy service ``` pgbackweb: image: eduardolat/pgbackweb:0.5.1 container_name: pgbackweb environment: ... PBW_PATH_PREFIX: /pgbackweb labels: - "traefik.enable=true" - "traefik.http.routers.pgbackweb.rule=PathPrefix(`/pgbackweb`)" - "traefik.http.routers.pgbackweb.entrypoints=web" - "traefik.http.services.pgbackweb.loadbalancer.server.port=8085" - "traefik.http.middlewares.pgbackweb-stripprefix.stripprefix.prefixes=/pgbackweb" - "traefik.http.routers.pgbackweb.middlewares=pgbackweb-stripprefix" restart: unless-stopped ``` Answer the same: {"message":"Not Found"}
Author
Owner

@xbreaker commented on GitHub (Jan 17, 2026):

Deleting stripprefix middleware solved issue for me

<!-- gh-comment-id:3762849287 --> @xbreaker commented on GitHub (Jan 17, 2026): Deleting stripprefix middleware solved issue for me
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/pgbackweb#123
No description provided.