Crossbar caddy reverse proxy

1.2k Views Asked by At

How could I set a reverse proxy with caddy that speak with a crossbar router?

I have a docker with a crossbar router that listen on localhost 8080, and I use caddy as a reverse proxy.

Below the Caddyfile:

`0.0.0.0:80
 proxy /ws localhost:8080{
     proxy_header Connection {>Connection}
     proxy_heade Upgrade {>Upgrade}
 }
 header /ws {
     Upgrade "WebSoket"
     Connection "Upgrade"
 }`

'tcpflow 8080' return nothing when I try to connect.

Below the header from chrome:

RESPONSE

HTTP/1.1 101 Switching Protocols
Connection: Upgrade
Sec-Websocket-Accept: r/PdCQJibmcb5XrfVbnSXJMuf9g=
Sec-Websocket-Protocol: wamp.2.json
Server: Caddy
Server: Crossbar/0.11.1
Upgrade: WebSocket
X-Powered-By: AutobahnPython/0.10.9
Date: Tue, 09 Feb 2016 14:12:04 GMT

REQUEST

GET ws://78.46.244.23/ws HTTP/1.1
Host: 78.46.244.23
Connection: Upgrade
Pragma: no-cache
Cache-Control: no-cache
Upgrade: websocket
Origin: chrome://newtab
Sec-WebSocket-Version: 13
User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTM 
   like Gecko) Chrome/48.0.2564.103 Safari/537.36
Accept-Encoding: gzip, deflate, sdch
Accept-Language: it-IT,it;q=0.8,en-US;q=0.6,en;q=0.4
Sec-WebSocket-Key: OaEUxWnqjZWyfLypeYxeXw==
Sec-WebSocket-Extensions: permessage-deflate; client_max_window_bits
Sec-WebSocket-Protocol: wamp.2.json

Below the frame:

[1,"realm1",{"roles":{"caller":{"features":{"caller_identification":true,"progressive_call_results":true}},"callee":{"features":{"progressive_call_results":true}},"publisher":{"features":{"subscriber_blackwhite_listing":true,"publisher_exclusion":true,"publisher_identification":true}},"subscriber":{"features":{"publisher_identification":true}}}}]

And the console error:

WebSocket connection to 'ws://78.46.244.23/ws' failed: Invalid frame header
1

There are 1 best solutions below

0
On

you have a typo in your Caddyfile:

Upgrade "WebSoket"