diff --git a/seb4itik/byow/roles/caddy/templates/Caddyfile b/seb4itik/byow/roles/caddy/templates/Caddyfile index 674224a..fb38895 100644 --- a/seb4itik/byow/roles/caddy/templates/Caddyfile +++ b/seb4itik/byow/roles/caddy/templates/Caddyfile @@ -48,31 +48,31 @@ # 0=origin, 1=methods, 2=headers, 3=allow credentials, 4=max age, 5=vary, 6=expose headers (cors) { - @match-cors-preflight-{args.0} { - header Origin {args.0} + @match-cors-preflight-{args[0]} { + header Origin {args[0]} method OPTIONS } - header @match-cors-preflight-{args.0} { - Access-Control-Allow-Origin "{args.0}" - Access-Control-Allow-Methods "{args.1}" - Access-Control-Allow-Headers "{args.2}" - Access-Control-Allow-Credentials "{args.3}" - Access-Control-Max-Age "{args.4}" - Vary "{args.5}" + header @match-cors-preflight-{args[0]} { + Access-Control-Allow-Origin "{args[0]}" + Access-Control-Allow-Methods "{args[1]}" + Access-Control-Allow-Headers "{args[2]}" + Access-Control-Allow-Credentials "{args[3]}" + Access-Control-Max-Age "{args[4]}" + Vary "{args[5]}" } - handle @match-cors-preflight-{args.0} { + handle @match-cors-preflight-{args[0]} { respond "" 204 } - @match-cors-request-{args.0} { - header Origin {args.0} + @match-cors-request-{args[0]} { + header Origin {args[0]} not method OPTIONS } - header @match-cors-request-{args.0} { - >Access-Control-Allow-Origin "{args.0}" - >Access-Control-Allow-Credentials "{args.3}" - >Vary "{args.5}" - >Access-Control-Expose-Headers "{args.6}" + header @match-cors-request-{args[0]} { + >Access-Control-Allow-Origin "{args[0]}" + >Access-Control-Allow-Credentials "{args[3]}" + >Vary "{args[5]}" + >Access-Control-Expose-Headers "{args[6]}" } }