I have a couple of React applications running locally with WDS on different ports.
- landing - running on port 3000 (http://localhost:3000)
- account - running on port 3100 (http://localhost:3100)
- help - running on port 3200 (http://localhost:3200).
I want to be able to access all of those via port 80, so:
- http://localhost would direct me to landing app (http://localhost:3000)
- Any route starting with http://localhost/account would direct me to account app (http://localhost:3100)
- Any route starting with http://localhost/help would direct me to help app (http://localhost:3200)
I have come up with the following Caddyfile config:
:80 {
reverse_proxy /account/* localhost:3100
reverse_proxy /help/* localhost:3200
reverse_proxy localhost:3000
}
The routing works, but for account pages, the static resources return 404, since the browser attempts to do GET http://localhost/main.css
, not GET http://localhost/dashboard/main.css
. I did add the base URL to account config, but that didn't help.