Sunday, April 23, 2017

Removing Xforward-ssl from Vary Header on Apache Webserver


If you insert any header for redirect  on your apache webserver then it will appear vary header.

RewriteCond %{HTTP:X-Forwarded-SSL} ^on$ [NC]
 RewriteRule ^/url.* https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]


eg .



  1. Content-Type:
    application/pdf
  2. Date:
    Sat, 22 Apr 2017 19:11:35 GMT
  3. Expires:
    Sun, 23 Apr 2017 19:11:35 GMT
  4. Keep-Alive:
    timeout=10, max=499
  5. Last-Modified:
    Thu, 19 Jan 2017 01:18:14 GMT
  6. Server:
    Apache
  7. Strict-Transport-Security:
    max-age=31536000; includeSubDomains
  8. Vary:
    X-Forwarded-SSL



This is ok if you don't have CDN ,since CDN don't like this header on vary, and you will have cache miss.

To over come this issue you need to make some changes on your Apache rewrite.

RewriteCond %{HTTP:X-Forwarded-SSL} ^on$ [NC,NV]
 RewriteRule ^/url.* https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]

NV is for no vary.

No comments:

curl and cacert

curl -v --cacert cacert.pem https://www.example/cgi-bin/f ile.xgi -I -X POST