laue727
(Lauer)
December 13, 2021, 5:15pm
1
1. Caddy version v2.4.6
2. How I run Caddy: Static web site
a. System environment: Ubuntu 20.04.3 LTS
d. My complete Caddyfile or JSON config:
testserver.com {
root * /var/www/testserver.com
header {
Strict-Transport-Security "max-age=31536000; includeSubtestservers; preload; always"
X-Frame-Options "SAMEORIGIN"
X-XSS-Protection "1; mode=block"
X-Content-Type-Options "nosniff"
server: test123webserver
}
}
3. The problem I’m having:
we would like to change the name of the web server in the header
4. Error messages and/or full log output:
the name is still Caddy
5. What I already tried:
we tried also:
header -Server test123webserver
when we use curl -v testserver.com we still get:
* Connected to testserver.com (63.22.26.100) port 80 (#0)
> GET / HTTP/1.1
> Host: testserver.com
> User-Agent: curl/7.64.1
> Accept: */*
>
< HTTP/1.1 308 Permanent Redirect
< Connection: close
< Location: https://testserver.com/
< Server: Caddy
< Date: Mon, 13 Dec 2021 16:57:05 GMT
< Content-Length: 0
<
* Closing connection 0
matt
(Matt Holt)
December 13, 2021, 5:34pm
2
Use curl -v https://testserver.com
to see the changes reflected – remember, Caddy serves your site over HTTPS automatically.
laue727
(Lauer)
December 13, 2021, 9:34pm
3
thank you when using curl -v https://testserver.com
it works!
but how do we make it work when using curl -v testserver.com
matt
(Matt Holt)
December 13, 2021, 11:06pm
4
The site you’ve defined in your Caddyfile is for HTTPS (because Caddy is HTTPS-default), and the HTTP site that redirects the client to HTTPS is implicitly created by Caddy (as part of automatic HTTPS ).
So to customize the HTTP site, simply add it to your Caddyfile, like any other site:
http://testserver.com {
...
}
Keep in mind that defining the HTTP site in your config will override Caddy’s implicit defaults, so you’ll also need to add the redirect back in if you want to keep that.
laue727
(Lauer)
December 13, 2021, 11:36pm
5
added it and it works perfectly thank you!!
1 Like
system
(system)
Closed
January 12, 2022, 5:15pm
6
This topic was automatically closed after 30 days. New replies are no longer allowed.