I‘m using Varnish cache infront of Apache web server and I’d like change my web server signature from
Apache/2.2.8 (Ubuntu) mod_python/3.3.1 Python/2.5.2 mod_ssl/2.2.8 OpenSSL/0.9.8g
To:
Apache Web server
How do I change headers using Varnish?
You can simply use the following configuration (edit Varnish config file) and append the following configuration:
unset beresp.http.Server; set beresp.http.Server = "Apache Web Server";
Save and close the file. Restart Varnish:
# /etc/init.d/varnish restart
OR
# /etc/init.d/varnish reload
How Do I Test New Headers?
Simply use curl command as follows:
$ curl -I http://www.example.com/
$ curl -I http://www.cyberciti.biz/
Sample outputs:
HTTP/1.1 200 OK
Server: Apache Web Server
Content-Type: text/html; charset=utf-8
Status: 200 OK
P3P: CP="NOI DSP COR NID ADMa OPTa OUR NOR"
X-UA-Compatible: IE=7
ntCoent-Length: 163218
X-Varnish: 3079018010 3079016087
Expires: Thu, 08 Jul 2010 16:21:52 GMT
Cache-Control: max-age=0, no-cache, no-store
Pragma: no-cache
Date: Thu, 08 Jul 2010 16:21:52 GMT
Connection: keep-alive
🐧 Get the latest tutorials on Linux, Open Source & DevOps via RSS feed or Weekly email newsletter.
🐧 1 comment so far... add one ↓
🐧 1 comment so far... add one ↓
Category | List of Unix and Linux commands |
---|---|
File Management | cat |
Firewall | Alpine Awall • CentOS 8 • OpenSUSE • RHEL 8 • Ubuntu 16.04 • Ubuntu 18.04 • Ubuntu 20.04 |
Network Utilities | dig • host • ip • nmap |
OpenVPN | CentOS 7 • CentOS 8 • Debian 10 • Debian 8/9 • Ubuntu 18.04 • Ubuntu 20.04 |
Package Manager | apk • apt |
Processes Management | bg • chroot • cron • disown • fg • jobs • killall • kill • pidof • pstree • pwdx • time |
Searching | grep • whereis • which |
User Information | groups • id • lastcomm • last • lid/libuser-lid • logname • members • users • whoami • who • w |
WireGuard VPN | Alpine • CentOS 8 • Debian 10 • Firewall • Ubuntu 20.04 |
I put the code on /etc/varnish/default.vcl on my centos box but varnish failed to start