caddyserver / caddy-docker

Source for the official Caddy v2 Docker Image
https://hub.docker.com/_/caddy
Apache License 2.0
408 stars 74 forks source link

Caddy Unable Reverse Proxy Server Websocket Response Back To Client Side #253

Closed jerrychong25 closed 2 years ago

jerrychong25 commented 2 years ago

Hi all,

I would like to reverse proxy client incoming websocket request to HTTP Backend (Node.js App) and vice versa (HTTP Backend websocket request to client side)

I've verified the HTTP Backend that Node.js App is returning correct response back to Caddy server. Also I've tried without Caddy server and Node.js App is responding websocket correctly without any errors.

Unfortunately Caddy server returns 400 Bad Request back to client side on same flow.

How could we resolve this issue since reverse proxy handles all these traffic in background?

I'm using Docker version with following Docker Compose configuraitons:

  https-proxy:
    image: caddy:2.5.2-alpine
    container_name: caddy-https-proxy
    restart: always
    depends_on:
      - proxy
    command: caddy reverse-proxy --from proxy.mydomain.com --to nodejs_app:3000
    volumes:
      - caddy_data:/data
      - caddy_config:/config
    ports:
      - "80:80"
      - "443:443"
    networks:
      - proxy_network

Similar issues:

Thanks in advance!

francislavoie commented 2 years ago

Duplicate of https://github.com/caddyserver/caddy/issues/4957