I've got a nodejs-express server running behind a Caddy 2 server as a reverse-proxy.
Caddy is running on a docker with the following configuration in docker-compose
caddy:
image: caddy
restart: always
ports:
- "443:443"
- "80:80"
networks:
- main-network
volumes:
- "./Caddyfile:/etc/caddy/Caddyfile"
With the following Caddyfile:
my-nice-site.com {
reverse_proxy /* server:4030
}
The setup is working nicely when serving a webpage and the API, however, I'm getting into CORS problems the moment I try to access using a javascript with a different ORIGIN.
I have set up CORS in the express server using express cors middleware and it works ok when using on its own, but I keep getting that when running it behind Caddy, so I guess there is some configuration I need to make in my Caddyfile to allow cors but I couldn't find anything that worked for my setup.