Varnish Change Web Server Signature Headers

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


CategoryList of Unix and Linux commands
Disk space analyzersdf duf ncdu pydf
File Managementcat cp mkdir tree
FirewallAlpine Awall CentOS 8 OpenSUSE RHEL 8 Ubuntu 16.04 Ubuntu 18.04 Ubuntu 20.04
Modern utilitiesbat exa
Network UtilitiesNetHogs dig host ip nmap
OpenVPNCentOS 7 CentOS 8 Debian 10 Debian 8/9 Ubuntu 18.04 Ubuntu 20.04
Package Managerapk apt
Processes Managementbg chroot cron disown fg glances gtop jobs killall kill pidof pstree pwdx time vtop
Searchingag grep whereis which
User Informationgroups id lastcomm last lid/libuser-lid logname members users whoami who w
WireGuard VPNAlpine CentOS 8 Debian 10 Firewall Ubuntu 20.04
1 comment… add one
  • khupcom Jun 3, 2013 @ 4:48

    I put the code on /etc/varnish/default.vcl on my centos box but varnish failed to start

Leave a Reply

Your email address will not be published.

Use HTML <pre>...</pre> for code samples. Still have questions? Post it on our forum