Enable CORS with Caddy plugin

Started by gtmax500, March 04, 2025, 02:32:20 AM

Previous topic - Next topic
Hello All,

This might be more appropriate in the Caddy forums, but I figured I'd start here since it relates to using the OPNSense Caddy plugin GUI.

I was hoping for some help on enabling CORS in the Caddy plugin. I am currently reverse proxing my Immich Server with the Caddy plugin and it works as expected. I am trying to utilize an Immich album in a Home Assistant dashboard and the instructions say I need to enable CORS in the web server to allow access to the api from a different domain. It goes on to give instructions on setting that up in nginx and traefik but not Caddy.

I have found guides on modifying the caddyfile to enable CORS but I cant figure out how that translates to the OPNSense plugin GUI. Any help would be appreciated. Thank you!

Caddy passed all headers through 1:1 in reverse_proxy mode.

The immich example is to enable CORS for its /own/ webserver that serves immich.

This means just configure it in immich.

If you cannot do that for some reason, use the Caddy Headers menu. Read about what the header_up and header_down directives do, and then attach these headers to your handler in advanced mode.

Though manipulating the headers with the reverse proxy is worse than adding them on the webserver of the reverse proxied application.
Hardware:
DEC740