1. Caddy version (caddy version
):
v2.0.0 h1:pQSaIJGFluFvu8KDGDODV8u4/QRED/OPyIR+MWYYse8=
2. How I run Caddy:
Installed Caddy via copr YUM repo
yum-config-manager --add-repo https://copr.fedorainfracloud.org/coprs/g/caddy/caddy/repo/epel-7/group_caddy-caddy-epel-7.repo
yum -y install caddy --disablerepo=epel
sed -i 's|:80|http://caddy.domain.com:81\n\nheader x-powered-by "caddy centminmod"\nheader vary Accept-Encoding\nencode gzip\n|' /etc/caddy/Caddyfile
caddy trust
cp -a /usr/share/caddy/index.html /usr/share/caddy/caddy-index.html
service caddy start
service caddy status
chkconfig caddy on
a. System environment:
- CentOS 7.8
- Nginx running on port 80 and 443
- VirtualBox on Windows 10 Pro
b. Command:
service caddy start
c. Service/unit/compose file:
[Unit]
Description=Caddy
Documentation=https://caddyserver.com/docs/
After=network.target
[Service]
User=caddy
Group=caddy
ExecStart=/usr/bin/caddy run --environ --config /etc/caddy/Caddyfile
ExecReload=/usr/bin/caddy reload --config /etc/caddy/Caddyfile
TimeoutStopSec=5s
LimitNOFILE=1048576
LimitNPROC=512
PrivateTmp=true
ProtectSystem=full
AmbientCapabilities=CAP_NET_BIND_SERVICE
[Install]
WantedBy=multi-user.target
d. My complete Caddyfile or JSON config:
{
http_port 81
https_port 4444
}
http://caddy.domain.com:81 {
header x-powered-by "caddy centminmod"
header vary Accept-Encoding
header X-Content-Type-Options nosniff
header X-XSS-Protection "1; mode=block"
encode gzip
# Set this path to your site's directory.
root * /usr/share/caddy
# Enable the static file server.
file_server
# Or serve a PHP site through php-fpm:
# php_fastcgi localhost:9000
log {
output file /var/log/caddy/access_http.log {
roll_size 100mb
roll_keep 10
roll_keep_for 720h
}
format single_field common_log
level INFO
}
}
https://caddy.domain.com:4444 {
tls internal
header x-powered-by "caddy centminmod"
header vary Accept-Encoding
header X-Content-Type-Options nosniff
header X-XSS-Protection "1; mode=block"
encode gzip
# Set this path to your site's directory.
root * /usr/share/caddy
# Enable the static file server.
file_server
# Or serve a PHP site through php-fpm:
# php_fastcgi localhost:9000
log {
output file /var/log/caddy/access_https.log {
roll_size 100mb
roll_keep 10
roll_keep_for 720h
}
format single_field common_log
level INFO
}
}
3. The problem I’m having:
In my web browser I am seeing duplicate Vary Accept-Encoding headers. But not seeing such duplicate headers on curl command line ?
On curl command line I see
curl -Ik https://caddy.domain.com:4444/caddy-index.html
HTTP/1.1 200 OK
Accept-Ranges: bytes
Content-Length: 12226
Content-Type: text/html; charset=utf-8
Etag: "q9xapl9fm"
Last-Modified: Wed, 06 May 2020 18:44:09 GMT
Server: Caddy
Vary: Accept-Encoding
X-Content-Type-Options: nosniff
X-Powered-By: caddy centminmod
X-Xss-Protection: 1; mode=block
Date: Fri, 08 May 2020 17:38:15 GMT
curl -Ik -H "Accept-Encoding:gzip" https://caddy.domain.com:4444/caddy-index.html
HTTP/1.1 200 OK
Accept-Ranges: bytes
Content-Length: 12226
Content-Type: text/html; charset=utf-8
Etag: "q9xapl9fm"
Last-Modified: Wed, 06 May 2020 18:44:09 GMT
Server: Caddy
Vary: Accept-Encoding
X-Content-Type-Options: nosniff
X-Powered-By: caddy centminmod
X-Xss-Protection: 1; mode=block
Date: Fri, 08 May 2020 17:38:28 GMT
But within web browser for same requested file I see duplicate headers
If I remove specific header for Vary in Caddyfile, the curl headers have Vary missing while browser adds Vary header
curl -Ik https://caddy.domain.com:4444/caddy-index.html
HTTP/1.1 200 OK
Accept-Ranges: bytes
Content-Length: 12226
Content-Type: text/html; charset=utf-8
Etag: "q9xapl9fm"
Last-Modified: Wed, 06 May 2020 18:44:09 GMT
Server: Caddy
X-Content-Type-Options: nosniff
X-Powered-By: caddy centminmod
X-Xss-Protection: 1; mode=block
Date: Fri, 08 May 2020 17:42:19 GMT
curl -Ik -H "Accept-Encoding:gzip" https://caddy.domain.com:4444/caddy-index.html
HTTP/1.1 200 OK
Accept-Ranges: bytes
Content-Length: 12226
Content-Type: text/html; charset=utf-8
Etag: "q9xapl9fm"
Last-Modified: Wed, 06 May 2020 18:44:09 GMT
Server: Caddy
X-Content-Type-Options: nosniff
X-Powered-By: caddy centminmod
X-Xss-Protection: 1; mode=block
Date: Fri, 08 May 2020 17:42:26 GMT