How do I enables CORS on Caddy v2?
1. My Caddy version (
2. How I run Caddy:
Please provide all of the relevant information and DO NOT REDACT anything except passwords/keys. Thank you!
systemctl reload caddy
a. System environment:
DigitalOcean “Create Caddy Droplet”
VERSION 2.0.0-beta10 OS Ubuntu 18.04
c. Service/unit/compose file:
d. My complete Caddyfile:
# The Caddyfile is an easy way to configure your Caddy web server. # # Unless the file starts with a global options block, the first # uncommented line is always the address of your site. # # To use your own domain name (with automatic HTTPS), first make # sure your domain's A/AAAA DNS records are properly pointed to # this machine's public IP, then replace the line below with your # domain name. :80 # Set this path to your site's directory. root * /usr/share/caddy # Enable the static file server. file_server # CORS header https://enable-cors.org/server_caddy.html #cors # Another common task is to set up a reverse proxy: # reverse_proxy localhost:8080 # Or serve a PHP site through php-fpm: # php_fastcgi localhost:9000 # Refer to the Caddy docs for more information: # https://github.com/caddyserver/caddy/wiki/v2:-Documentation
3. The problem I’m having:
I would like add the CORS authorization to the header using Caddy. I can not find the documentation that details the v2 replacement for adding
cors to the caddyfile
4. Error messages and/or full log output:
Please DO NOT REDACT any information except passwords/keys.
Job for caddy.service failed because the control process exited with error code.
See “systemctl status caddy.service” and “journalctl -xe” for details.