varnish don't resolve ESI in my localhost - apache

varnish don't resolve ESI in my localhost:
i have similar configuration like other users in apache, but i send/get following headers:
Server Apache/2.2.21 (Debian)
X-Powered-By PHP/5.3.8-2
Content-Encoding gzip
Edge-Control cache-maxage=31536000s
Cache-Control public, max-age=31536000
Pragma public
Expires Tue, 30 Oct 2012 11:41:15 GMT
ProcessID 3918
Etag c2e6665981c6441ab860d12a6853a002
Vary Accept-Encoding
Content-Type text/html; charset=UTF-8
Content-Length 4193
Date Mon, 31 Oct 2011 10:40:54 GMT
X-Varnish 630755530
Age 0
Via 1.1 varnish
Request Headersview source
Host i.host.com
User-Agent Mozilla/5.0 (X11; Linux x86_64; rv:7.0.1) Gecko/20100101 Firefox/7.0.1 Iceweasel/7.0.1
Accept text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language en-us,en;q=0.5
Accept-Encoding gzip, deflate
Accept-Charset ISO-8859-1,utf-8;q=0.7,*;q=0.7
Connection keep-alive
Cookie OAX=1I6M006JYzwABwNj; __utma=164510763.315921951.1317626740.1319722611.1319795071.39; __utmz=164510763.1317626740.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none); __utma=229641156.678788339.1317628577.1320057939.1320060143.19; __utmz=229641156.1317628577.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none); lang=es; __utmc=229641156; __utmb=229641156.4.10.1320060143
If-None-Match c2e6665981c6441ab860d12a6853a002
Cache-Control max-age=0
other user example that works:
Server Apache/2.2.4 (Win32) PHP/5.3.5
X-Powered-By PHP/5.3.5
Set-Cookie lang=es; expires=Mon, 31-Oct-2011 11:46:01 GMT; path=/
Edge-control cache-maxage=31536000s
Cache-Control public, max-age=31536000
Pragma public
Expires Tue, 30 Oct 2012 10:46:01 GMT
ProcessID 3824
Etag f9dcd4b1ec3f40e6763e80a3ba195de3
Content-Type text/html; charset=UTF-8
Transfer-Encoding chunked
Date Mon, 31 Oct 2011 10:46:01 GMT
X-Varnish 630755925
Age 0
Via 1.1 varnish
Connection keep-alive
Cabeceras de la peticiónver fuente
Host t.host.com
User-Agent Mozilla/5.0 (Windows NT 5.1; rv:5.0) Gecko/20100101 Firefox/5.0
Accept text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language es-es,es;q=0.8,en-us;q=0.5,en;q=0.3
Accept-Encoding gzip, deflate
Accept-Charset ISO-8859-1,utf-8;q=0.7,*;q=0.7
Connection keep-alive
Cookie OAX=1I6M001BiwUAB0EE; __utma=164510763.1374034467.1296142874.1319189845.1319204625.107; __utmz=164510763.1319204625.107.79.utmcsr=tamara.eitb.com|utmccn=(referral)|utmcmd=referral|utmcct=/eu/eguraldia/eskia/; __utma=261580168.2132154740.1302611206.1319197586.1320057948.90; __utmz=261580168.1302611206.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none); lang=es; __utmb=261580168.1.10.1320057948; __utmc=261580168
i don't know why i receive different headers from varnish...
i get:
Content-Encoding gzip
Vary Accept-Encoding
why i get this headers and the other users no???
both have mod_deflate on...

you´re getting both Content-Encoding and Vary in order to Varnish, an a user-agent, properly handle the request. While Content-Encoding tells Vanish, an a user-agent, that the page content is encoded in a zip format, gzip in your case, the header Vary tells, specially Varnish to cache both versions of the page with or without gzip compression.
If backend is compression encoding aware, it can deliver a version with compression (gzip or deflate) or it can deliver a version withou any compression (text/html for example).
But, to enable ESI processing in varnish, use the esi; command on your vcl file. See this page for more information:

Related

How to Preventing Host Header Attack in Ubuntu Server 14.04

If we send a request from any host like example.com our server gives back a HTTP 1.1 200 OK response status.
In correct condition it should show either 302, 400 or 404 error message (not found response) status. At current condition it is showing 200 OK response message, when its send through our host like xx.xxx.xx.xx.
For example, if we sent this request:
GET /web/ HTTP/1.1 Host: example.com User-Agent: Mozilla/5.0 (Windows
NT 10.0; WOW64; rv:51.0) Gecko/20100101 Firefox/51.0 Accept:
text/html,application/xhtml+xml,application/xml;q=0.9,/;q=0.8
Accept-Language: en-US,en;q=0.5 Connection: close
Upgrade-Insecure-Requests: 1
We get this response:
HTTP/1.1 200 OK Date: Thu, 02 Mar 2017 15:23:20 GMT Server:
figi_Server X-Frame-Options: deny Strict-Transport-Security: 1 Vary:
Accept-Encoding X-Content-Type-Options: nosniff X-Frame-Options:
sameorigin X-XSS-Protection: 1; mode=block
Using
OS: Ubuntu 14.04.
Web server: Apache 2.2.
Virtual machine running both.
Please go through Screen Shot Of Issue for better Understanding of Issue:

Why does the web server sent the file instead of a 304 http: not modified?

My browser send to the server the following request:
Host: www.imprimante.be
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:38.0) Gecko/20100101 Firefox/38.0
Accept: */*
Accept-Language: fr,fr-FR;q=0.8,en-US;q=0.5,en;q=0.3
Accept-Encoding: gzip, deflate
If-Modified-Since: Fri, 29 May 2015 14:22:44 GMT
If-None-Match: "90-5173935ad3a1a-gzip"
Referer: http://www.imprimante.be/premier-avis-gratuit/
Cookie: <hidden>
Connection: keep-alive
The url used is http://www.imprimante.be/wp-content/themes/mch_imprimante/js/theme.min.js? (note: www.imprimante.be is not accessible trough wlan yet)
And the server send me the file with this (status 200) http header:
Accept-Ranges: bytes
Connection: Keep-Alive
Content-Encoding: gzip
Content-Length: 137
Content-Type: application/javascript
Date: Wed, 03 Jun 2015 07:18:03 GMT
Etag: "90-5173935ad3a1a-gzip"
Keep-Alive: timeout=5, max=99
Last-Modified: Fri, 29 May 2015 14:22:44 GMT
Server: Apache/2.4.10 (Debian)
Vary: Accept-Encoding
As you might notice (Last-Modified: Fri, 29 May 2015 14:22:44 GMT) the file hasn't been modified since the last request.
So I don't get why the response isn't a 304 status: not modified.
I'd really like to know why the caching of this files (and some others) doesn't work as I expect it.
It is bug in Apache. Turn off mod_deflate.

How to configure Apache to send gzipped and chunked encoded response for static content?

For the purpose of unit testing, I want to configure Apache to gzip a static file and then chunk encode it and send it as a response. I tried following so far:
# Created a file httpd-deflate.conf
# Set to gzip all output
SetOutputFilter DEFLATE
#set compression level
DeflateCompressionLevel 9
# Deflate in chunks
DeflateBufferSize 100
Included this file in httpd.conf
Include httpd-deflate.conf
Send request as follows:
GET / HTTP/1.1
Host: test-server
Accept-Encoding: gzip
Connection: Keep-Alive
Got following response:
HTTP/1.1 200 OK
Date: Wed, 05 Nov 2014 19:24:23 GMT
Server: Apache/2.2.15 (Scientific Linux)
Last-Modified: Wed, 05 Nov 2014 18:17:21 GMT
ETag: "5e28c-5df-5072097390e40"
Accept-Ranges: bytes
Vary: Accept-Encoding
Content-Encoding: gzip
Content-Length: 1186
Connection: close
Content-Type: text/html; charset=UTF-8
<binary-data>
Is there a way by which Apache can start sending the gziped data in chunked format. I thought DeflateBufferSize can help me do that. However, no luck so far.
Any suggestions?
Thanks.

IIS responding with 304 HTTP status to non-conditional requests

Sometimes my IIS server starts responding with 304 HTTP status to non-conditional requests. I have yet to determine exactly when this happens, but when it starts all browsers keep getting 304.
This is the request (debugged using fiddler):
GET http://www.example.com/aaa/bbb/GetStaticResult HTTP/1.1
Host: www.example.com
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:28.0) Gecko/20100101 Firefox/28.0
Accept: */*
Accept-Language: es-ES,es;q=0.8,en-US;q=0.5,en;q=0.3
Accept-Encoding: gzip, deflate
Referer: http://localhost:12345/xxx
Origin: http://localhost:12345
Connection: keep-alive
Pragma: no-cache
Cache-Control: no-cache
And the response:
HTTP/1.1 304 Not Modified
Cache-Control: public
Expires: Thu, 30 Apr 2015 09:23:22 GMT
Last-Modified: Wed, 30 Apr 2014 09:23:22 GMT
Server: Microsoft-IIS/7.5
X-Powered-By: ASP.NET
Date: Wed, 30 Apr 2014 10:33:58 GMT
The ASP.NET MVC method is the following:
[HttpGet]
[OutputCache(Duration = int.MaxValue, VaryByParam = "")]
public string GetStaticResult()
{
return "static";
}
The request hasn't any If-Modified-Since (or similar) header. Shouldn't the server issue a 200 response?
May be related with Getting a 304 if there is no If-Modified-Since sent?

HTTP header "Via:1.1 nc1 (NetCache NetApp/6.0.5P1)" stops IIS6 gzip compression

The request I sent is accept gzip but the response is not compressed, instead, I received some header
Via:1.1 nc1 (NetCache NetApp/6.0.5P1)
I guess this is to do with my ISP since it works perfectly on my home computer.
Any idea how to get the response compressed?
Request header
GET /test.aspx HTTP/1.1
Host this.is.example.com
User-Agent Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.9.0.3) Gecko/2008092417 Firefox/3.0.3 (.NET CLR 3.5.30729)
Accept text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language en-us,en;q=0.5
Accept-Encoding gzip,deflate
Accept-Charset ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive 300
Pragma no-cache
Cache-Control no-cache
Response header
HTTP/1.1 200 OK
Date Mon, 01 Dec 2008 19:53:40 GMT
Content-Length 6099
Content-Type text/html; charset=utf-8
Cache-Control private
Server Microsoft-IIS/6.0
X-Powered-By ASP.NET
X-AspNet-Version 2.0.50727
Via 1.1 nc1 (NetCache NetApp/6.0.5P1)
Expires 0
Cache-Control no-cache
// I expect content-encoding to be gzip here
Thanks in advance.
There's no mechanism to force response compression. Accept-Encoding: gzip only tells the webserver/proxy that it MAY compress the response, not that it MUST encode the response. There are many webservers and proxies that don't support gzip out of the box, or have it configured off by default.
The Via header that you found is frequently inserted by proxies that connect to the intended webserver on your behalf, and is informational. It's unrelated to your compression woes.