Skip to content

Instantly share code, notes, and snippets.

@skeptrunedev
Created June 11, 2025 08:37
Show Gist options
  • Save skeptrunedev/e2ab54688d1b2d41d448aa62354f4618 to your computer and use it in GitHub Desktop.
Save skeptrunedev/e2ab54688d1b2d41d448aa62354f4618 to your computer and use it in GitHub Desktop.
Caddy Cors Allow Anything Setup
# Global options
{
email [email protected]
debug
}
(cors) {
@cors_preflight method OPTIONS
handle @cors_preflight {
header Access-Control-Allow-Origin "*"
header Access-Control-Allow-Methods "*"
header Access-Control-Allow-Headers "*"
header Access-Control-Allow-Credentials "true"
header Access-Control-Max-Age "86400"
respond "" 204
}
header Access-Control-Allow-Origin "*"
header Access-Control-Allow-Credentials "true"
header Access-Control-Expose-Headers "*"
}
listmonk.skeptrune.com {
import cors
reverse_proxy localhost:9000
}
@skeptrunedev
Copy link
Author

You can use this config on any domain you are hosing via caddy to make sure that all cors requests to it succeed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment