TanStackT
TanStack4mo ago
25 replies
good-rose

POST requests hang forever

I'm trying to deploy my app using caddy as a reverse proxy. My Tanstack Start app (behind fastify) works fine using
docker
but as soon as I add caddy:

services:
  proxy:
    image: caddy:2-alpine
    restart: unless-stopped
    ports:
      - "8080:80"
    volumes:
      - ./Caddyfile:/etc/caddy/Caddyfile

  app:
    restart: unless-stopped
    build:
      context: .
      dockerfile: Dockerfile
    ports:
      - "3000:3000"
    environment:
      - NODE_ENV=production
      - PORT=3000


where Caddyfile is:

:80 {
    encode gzip zstd

    reverse_proxy app:3000 {
        header_up Host {host}
        header_up X-Real-IP {remote_host}
        header_up X-Forwarded-For {remote_host}
        header_up X-Forwarded-Proto {scheme}
    }
}


then GET requests work fine (even files) but POST requests hang forever.

Does anyone have any idea what could cause this?
Was this page helpful?