I have a server which currently redirects everything to a web app running in a docker container on the same machine.
I would like to direct urls beginning /mail to an instance of mailcatcher running in another docker container.
[This post editied to add new stuff I have tried] I got so far with
ServerName myserver.uk
ServerAlias www.myserver.uk
ServerAdmin serveradmin@protonmail.com
ProxyPreserveHost On
# My attempts to get MailCatcher working
# Rewrite rules are a complete mystery to me, I'm just taking these from one of the tutorials I have found
# Every tutorial seems to do it differently, which is confusing!
# Is websocket some magic keyword?
RewriteEngine on
RewriteCond ${HTTP:Upgrade} websocket [NC]
RewriteCond ${HTTP:Connection} upgrade [NC]
RewriteRule .* "wss:/localhost:1080/$1" [P,L]
ProxyPassMatch (.*)(\/websocket)$ "ws://127.0.0.1:1080/$1$2"
ProxyPass /assets/ http://localhost:1080/assets/
ProxyPassReverse /assets/ http://localhost:1080/assets/
ProxyPass /messages/ http://localhost:1080/messages/
ProxyPassReverse /messages/ http://localhost:1080/messages/
ProxyPass /mail/ http://localhost:1080/
ProxyPassReverse /mail/ http://localhost:1080/
# The main web app
ProxyPass / http://localhost:8090/
ProxyPassReverse / http://localhost:8090/
but I discover mailcatcher uses Web Sockets. If I run a console window in by browser, I see:
GET https://myserver.uk/messages 404 (Not Found)
mailcatcher.js:5 WebSocket connection to 'wss://myserver/messages' failed: Error during WebSocket handshake: Unexpected response code: 404
I am obviously missing something - what should I change in my apache configuration?