Skip to content

Instantly share code, notes, and snippets.

@nimezhu
Forked from ryanburnette/Caddyfile
Created December 21, 2021 18:58
Show Gist options
  • Save nimezhu/42c6549d7d8206d0445c3e86d1d5a497 to your computer and use it in GitHub Desktop.
Save nimezhu/42c6549d7d8206d0445c3e86d1d5a497 to your computer and use it in GitHub Desktop.
Caddy v2.1 CORS whitelist
(cors) {
@origin{args.0} header Origin {args.0}
header @origin{args.0} Access-Control-Allow-Origin "{args.0}"
}
myawesomewebsite.com {
root * /srv/public/
file_server
header Access-Control-Allow-Methods "POST, GET, OPTIONS"
header Access-Control-Allow-Headers "*"
import cors https://member.myawesomewebsite.com
import cors https://customer.myawesomewebsite.com
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment