Traefik Reverse Proxy on Railway App
mon7792
PROOP

5 months ago

PROBLEM:

I am currently experimenting my setup for web apps.

I am trying to setup traefik reverse proxy, however unable to do so.

getting 502

TO BE SETUP(aiming for)

Namecheap -> Cloudflare -> traefik -> service

USECASE:

- setup rate limiting

- setup of waf & crowd sec

Custom Traefik Docker Container

`traefik.yml`:

api:
  dashboard: false

providers:
  file:
    directory: /etc/traefik/dynamic
    watch: true

log:
  level: INFO

global:
  checkNewVersion: false
  sendAnonymousUsage: false

`traefik-dynamic.yml`:

http:
  routers:
    frontend:
      rule: "PathPrefix(`/`)"
      middlewares:
        - compress
        - rate-limit
      service: frontend-service
      priority: 10

  services:
    frontend-service:
      loadBalancer:
        servers:
          - url: "http://booth.railway.internal:3000"

  middlewares:
    rate-limit:
      rateLimit:
        average: 100
        period: 1m
        burst: 50

    compress:
      compress: {}

`entrypoint.sh`

#!/bin/sh
set -e

echo "Starting Traefik on Railway port: ${PORT}"

exec traefik \
  --entrypoints.web.address="0.0.0.0:${PORT}" \
  --entrypoints.web.forwardedheaders.insecure=true \
  --providers.file.directory=/etc/traefik/dynamic \
  --providers.file.watch=true \
  --log.level=INFO

`Dockerfile`:

FROM traefik:v3.6

# Optional debugging tools
RUN apk add --no-cache curl

# Copy static & dynamic configs
COPY traefik.yml /etc/traefik/traefik.yml
COPY traefik-dynamic.yml /etc/traefik/dynamic/traefik-dynamic.yml

# Entrypoint
COPY entrypoint.sh /entrypoint.sh
RUN chmod +x /entrypoint.sh

# 🚫 DO NOT expose ports
ENTRYPOINT ["/entrypoint.sh"]

when i try to access `https://reverse-proxy-production-0842.up.railway.app/`

getting failed to Application failed to respond screen.

Request ID: 2pU0KKuHRRiT_QAHYqdHTg

Kindly help here, what am i doing wrong ?

0 Replies

Welcome!

Sign in to your Railway account to join the conversation.

Loading...