1. Caddy version (caddy version
): 2.4.5
2. How I run Caddy:
a. System environment:
Windows 10: OS Build 19042.1237
b. Command:
caddy run --watch
ngrok http 8888
c. Service/unit/compose file:
N/A
d. My complete Caddyfile or JSON config:
:8888 {
handle / {
@200 {
expression {http.error.status_code} == 200
}
rewrite @200 /index.html
file_server
}
handle /api/v1/ {
reverse_proxy localhost:3000
header {
Access-Control-Allow-Origin "*"
Access-Control-Allow-Methods "GET"
}
}
handle /api/v2/ {
reverse_proxy localhost:3001
}
file_server {
hide index.html
hide 404.html
}
handle_errors {
@404 {
expression {http.error.status_code} == 404
}
rewrite @404 /404.html
file_server
}
}
3. The problem I’m having:
When going to my proxy endpoint /api/v2/ there is no cors error when I didn’t provide any cors header directive. How do I show cors error if I dont put any cors headers directive?
4. Error messages and/or full log output:
N/A
5. What I already tried:
Didnt provide any header directive of Access-Control-Allow-Origin "*"
6. Links to relevant resources:
N/A