Postgreus behind Reverse Proxy (Traefik) #392

Closed
opened 2026-04-05 16:16:21 +02:00 by MrUnknownDE · 0 comments
Owner

Originally created by @schmidt-software on 11/25/2025

Is it possible to run PostgreSQL behind a reverse proxy or load balancer (e.g., Traefik)?

What would the corresponding configuration look like?

My docker-compose.yml file for docker swarm looks like this:

postgresus:
  image: rostislavdugin/postgresus:latest
  networks:
    - backend
    - frontend
  volumes:
    - postgreus_data:/postgresus-data
  deploy:
    replicas: 1
    labels:
      - "traefik.enable=true"
      - "traefik.http.routers.postgreus.rule=Host(`my.domain.com`) && PathPrefix(`/postgreus`)"
      - "traefik.http.routers.postgreus.entrypoints=websecure"
      - "traefik.http.routers.postgreus.tls=true"
      - "traefik.http.routers.postgreus.tls.certresolver=rt53"
      - "traefik.http.services.postgreus.loadbalancer.server.port=4005"
      - "traefik.http.middlewares.postgreus.stripprefix.prefixes=/postgreus"
      - "traefik.http.routers.postgreus.middlewares=postgreus"
      - "traefik.swarm.network=frontend"
    restart_policy:
      condition: on-failure
      delay: 5s
      max_attempts: 3
      window: 120s

When I access the URL, I only see a blank page with the following HTML source code:

<!doctype html>
<html lang="en">
<head>

<link rel="icon" type="image/svg+xml" href="/logo.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="robots" content="noindex" />
<title>Postgresus - PostgreSQL backups</title>
 
<link rel="preconnect" href="https://fonts.googleapis.com" />
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
<link
href="https://fonts.googleapis.com/css2?family=Jost:ital,wght@0,100..900;1,100..900&display=swap"
rel="stylesheet"
/>
<script type="module" crossorigin src="/assets/index-B40e32m5.js"></script>
<link rel="stylesheet" crossorigin href="/assets/index-C29yFBK7.css">
</head>
 
<body>
<div id="root"></div>
</body>
</html>

The log of the Posgreus container:

postgreus_postgresus.1.limf3cm156gn@moni    | [GIN] 2025/11/25 - 12:20:49 | 200 |     798.262µs |  XXX.XXX.XXX.XXX | GET      "/"
postgreus_postgresus.1.limf3cm156gn@moni    | [GIN] 2025/11/25 - 12:22:06 | 304 |     168.048µs |  XXX.XXX.XXX.XXX | GET      "/"

What have I overlooked? Any help is greatly appreciated.

*Originally created by @schmidt-software on 11/25/2025* Is it possible to run PostgreSQL behind a reverse proxy or load balancer (e.g., Traefik)? What would the corresponding configuration look like? My `docker-compose.yml` file for docker swarm looks like this: ``` postgresus: image: rostislavdugin/postgresus:latest networks: - backend - frontend volumes: - postgreus_data:/postgresus-data deploy: replicas: 1 labels: - "traefik.enable=true" - "traefik.http.routers.postgreus.rule=Host(`my.domain.com`) && PathPrefix(`/postgreus`)" - "traefik.http.routers.postgreus.entrypoints=websecure" - "traefik.http.routers.postgreus.tls=true" - "traefik.http.routers.postgreus.tls.certresolver=rt53" - "traefik.http.services.postgreus.loadbalancer.server.port=4005" - "traefik.http.middlewares.postgreus.stripprefix.prefixes=/postgreus" - "traefik.http.routers.postgreus.middlewares=postgreus" - "traefik.swarm.network=frontend" restart_policy: condition: on-failure delay: 5s max_attempts: 3 window: 120s ``` When I access the URL, I only see a blank page with the following HTML source code: ``` <!doctype html> <html lang="en"> <head> <link rel="icon" type="image/svg+xml" href="/logo.svg" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" /> <meta name="robots" content="noindex" /> <title>Postgresus - PostgreSQL backups</title>   <link rel="preconnect" href="https://fonts.googleapis.com" /> <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin /> <link href="https://fonts.googleapis.com/css2?family=Jost:ital,wght@0,100..900;1,100..900&display=swap" rel="stylesheet" /> <script type="module" crossorigin src="/assets/index-B40e32m5.js"></script> <link rel="stylesheet" crossorigin href="/assets/index-C29yFBK7.css"> </head>   <body> <div id="root"></div> </body> </html> ``` The log of the Posgreus container: ``` postgreus_postgresus.1.limf3cm156gn@moni | [GIN] 2025/11/25 - 12:20:49 | 200 | 798.262µs | XXX.XXX.XXX.XXX | GET "/" postgreus_postgresus.1.limf3cm156gn@moni | [GIN] 2025/11/25 - 12:22:06 | 304 | 168.048µs | XXX.XXX.XXX.XXX | GET "/" ``` What have I overlooked? Any help is greatly appreciated.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github/databasus#392