1. Caddy version (caddy version
):
v2.1.1 h1:X9k1+ehZPYYrSqBvf/ocUgdLSRIuiNiMo7CvyGUQKeA=
2. How I run Caddy:
As a service on Ubuntu
a. System environment:
Ubuntu 18.04
b. Command:
caddy reload ./Caddyfile
c. Service/unit/compose file:
paste full file contents here
d. My complete Caddyfile or JSON config:
# 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 * /opt/ivt/apps/6.0.0/packages/client/spa
# Enable the static file server.
file_server * {
root /opt/ivt/apps/6.0.0/packages/client/spa
}
file_server * {
root /opt/ivt/photography
}
# 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
# This is pointing to Let's Encrypt Staging environment (for dev)
# https://letsencrypt.org/docs/staging-environment/
# This will allow you to get things right before issuing trusted
# certificates and reduce the chance of your running up against rate limits.
acme_ca https://acme-staging-v02.api.letsencrypt.org/directory
# causes all certificates to be issued internally by default,
# rather than through a (public) ACME CA such as Let's Encrypt.
# This is useful in development environments.
local_certs
# configure automatic HTTPS. It can either disable it entirely (off)
# or disable only HTTP-to-HTTPS redirects (disable_redirects).
auto_https
# Refer to the Caddy docs for more information:
# https://caddyserver.com/docs/caddyfile
(header_options) {
header_up X-Real-IP {remote_host}
header_up X-Forwarded-Proto {scheme}
header_up Access-Control-Allow-Origin *
header_up Access-Control-Allow-Credentials true
header_up Access-Control-Allow-Headers Cache-Control,Content-Type
}
localhost {
route /weather/* {
uri replace /weather /socket.io
reverse_proxy * http://localhost:3010 {
import header_options
}
}
route /ptz/* {
uri replace /ptz /socket.io
reverse_proxy * http://localhost:3006 {
import header_options
}
}
route /liveview/* {
uri replace /liveview /socket.io
reverse_proxy * http://localhost:3004 {
import header_options
}
}
route /archive/* {
uri replace /archive /socket.io
reverse_proxy * http://localhost:3003 {
import header_options
}
}
route /alarms/* {
uri replace /alarms /socket.io
reverse_proxy * http://localhost:3002 {
import header_options
}
}
route /console_socket/* {
uri replace /console_socket /console/socket.io
reverse_proxy * http://localhost:3001 {
import header_options
}
}
route /web_app_socket/* {
uri replace /web_app_socket /web/socket.io
reverse_proxy * http://localhost:3001 {
import header_options
}
}
route /api/* {
reverse_proxy * http://localhost:3001 {
import header_options
}
}
}
3. The problem I’m having:
Previously, back in April when I was investigating Caddy, we came up with using some snippets (here: Need help converting NGINX config - #21 by francislavoie).
Now, I get the following error:
run: adapting config using caddyfile: ./Caddyfile:60 - Error during parsing: File to import not found: header_options
4. Error messages and/or full log output:
run: adapting config using caddyfile: ./Caddyfile:60 - Error during parsing: File to import not found: header_options
5. What I already tried:
I have tried using my original file that worked previously. The above Caddyfile is just a continuing effort to get static files also served.