Reverse proxy a subdirectory to a website expecting to be in the root
04:57 28 Dec 2021

I am using Caddy to provide SSL/HTTPS and then reverse proxying various url subdirectories to various websites/servers running on various local ports - mostly docker containers.

So:

https://example.org goes to localhost
https://example.org/calendar goes to localhost:8090
https://example.org/address goes to localhost:8091
https://example.org/files goes to localhost:8092

etc...

However some of the sites/services assume they hosted in the root domain and use absolute URL's so while the index.html pages are being served up OK for all the subdirectories/apps, links to CSS etc are all being routed to example.org/css etc rather than example.org//css

I want to avoid having to edit all the html/apps or using subdomains instead of subdirectories...

Any ideas how I might get around this issue?

docker subdomain reverse-proxy subdirectory caddy