How to chain reverse proxies with websockets?

I need to chain two reverse proxies with the websocket parameter.

https://example.com -> http://example.com -> 172.1.1.1:9999
  • The first reverse proxy works great: Opening http://example.com gets me to the application

  • The second proxy has problems: I get to the application, but it informs me that there is a problem with the websockets.

Is it in principle possible to chain reverse proxies which also also need to proxify websockets?

I haven’t heard any reason websockets would specifically not work in a proxy chain, but I’ve never tried it myself.

What’s your Caddyfile?

These were basic Caddyfiles (they are automatically generated, I am writing them from memory but these were absolutely basic setups)

https://example.com {
  proxy / https: {
    websockets
  }
}

and then

https://example.com {
  proxy / 172.1.1.1:9999 {
    websockets
  }
}

I solved my problem in the meantime by simplifying the setup which allowed me to avoid chaining proxies.

1 Like

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.