I figured out the problem and one stupid solution, but I am not sure if
I break something this way so I would like yo confirm that to me :) In
the following peace of code when I comment the unset everything works fine:
if (req.http.Accept-Encoding) {
if (req.http.Accept-Encoding ~ "gzip") {
# If the browser supports it, we'll use gzip.
#set req.http.Accept-Encoding = "gzip";
# unset req.http.Accept-Encoding;
}
else if (req.http.Accept-Encoding ~ "deflate") {
# Next, try deflate if it is supported.
set req.http.Accept-Encoding = "deflate";
}
else {
# Unknown algorithm. Remove it and send unencoded.
unset req.http.Accept-Encoding;
}
}
Why and am I break something this way? Can I remove it ?
On 12/02/2015 03:58 AM, Jason Price wrote:
Well, you'll need to figure out why the backend served a 404 request,
despite a valid looking Accept-Encoding header.
The above gives you all the details about the request, so you can turn
that into a curl request directly to the backend in question. That
will give you a triage tool. When you figure out why the curl request
fails, that will give you a hint as to what you need to change in your
VCL (or apache) config.
Could it be as simple as mod_deflate not accepting gzip, but
preferring the previous compression? (I know nothing of mod_deflate)
-Jason
On Tue, Dec 1, 2015 at 2:47 AM, [email protected]
<mailto:[email protected]> <[email protected]
<mailto:[email protected]>> wrote:
Thank you about your reply.
1. I understand, but the process for migrating is not so fast,
because of compile all from source including all vmods, building
new rpms and distributing them on many servers. Also, I am not
sure that this is the only one solution :)
2. The pipe was only for the test to see if only on the backends
will work. Now it's not piped, but the cache is stopped (it's all
the time stopped, because I use it only as a firewall for apache).
3. I wouild like to ask you to see this peace of log, because I
can't find anything anoying in it, but I am completely new to
varnish so it's possible I miss something. I see that here it's
accepting encoding gzip:
32 TxHeader b Host: mysite.com <http://mysite.com>
32 TxHeader b User-Agent: Mozilla/5.0 (X11; Ubuntu; Linux
i686; rv:42.0) Gecko/20100101 Firefox/42.0
32 TxHeader b Accept:
text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
32 TxHeader b Accept-Language: en-US,en;q=0.5
32 TxHeader b X-Country-Code: BG
32 TxHeader b X-Forwarded-For: IP, IP
32 TxHeader b X-Varnish: 1218787819
32 TxHeader b Accept-Encoding: gzip
32 RxProtocol b HTTP/1.1
32 RxStatus b 404
32 RxResponse b Not Found
32 RxHeader b Date: Tue, 01 Dec 2015 07:40:09 GMT
32 RxHeader b Server: Apache/2.2.27 (Unix) /5.0
mod_ssl/2.2.27 OpenSSL/1.0.1e-fips mod_bwlimited/1.4 mod_fastcgi/2.4.6
32 RxHeader b Vary: Accept-Encoding
32 RxHeader b Content-Encoding: gzip
32 RxHeader b Content-Length: 248
32 RxHeader b Connection: close
32 RxHeader b Content-Type: text/html; charset=iso-8859-1
32 Fetch_Body b 4(length) cls 0 mklen 1
32 Length b 248
32 BackendClose b default
30 SessionOpen c IP 59645 IP:80
30 ReqStart c IP 59645 1218787819
30 RxRequest c GET
30 RxURL c /favicon.ico
30 RxProtocol c HTTP/1.1
I read that it's possible to turn off completely mod_deflate from
apache and use varnish built in compression, but at this time this
is not solution for our company so I am trying to find another.
Best regards,
Georgi
On 12/01/2015 02:35 AM, Jason Price wrote:
First off, 3.0.7 is EOL. Move to 4.x as soon as you can
Second, I'd leave the entire stanza out of VCL. The varnish
defaults handle compression without issue in most cases. If the
backend serves compressed data, it'll be cached as compressed,
and served as compressed.
Third, once you 'pipe' a request, varnish does nothing other than
packet forwarding. It can't cache, it can't balance requests
across backends, nothing.
If the above doesn't resolve your problem, try to capture a
request Client and Backend side transaction in varnishlog. That
will help diagnose what the real problem is.
-Jason
On Mon, Nov 30, 2015 at 11:42 AM, [email protected]
<mailto:[email protected]> <[email protected]
<mailto:[email protected]>> wrote:
Hello,
I have been using varnish 3.7 only as a proxy server for
apache and have a following lines in default.vcl which should
handle the encodings:
if (req.http.Accept-Encoding) {
if (req.http.Accept-Encoding ~ "gzip") {
# If the browser supports it, we'll use gzip.
#set req.http.Accept-Encoding = "gzip";
unset req.http.Accept-Encoding;
}
else if (req.http.Accept-Encoding ~ "deflate") {
# Next, try deflate if it is supported.
set req.http.Accept-Encoding = "deflate";
}
else {
# Unknown algorithm. Remove it and send unencoded.
unset req.http.Accept-Encoding;
}
}
Although, customers which have mod_deflate rules in .htaccess
file experience the problem that their sites are not
compressed. If I pipe the site to apache site is compressed.
SO, my question is what is the problem with the deflate and
my varnish configuration? Is it required to add something
other to varnish to work the deflate? I tried a couple of
things which I found in the net, but nothing worked.
Thank you in advance for your answers!
Best regards,
Georgi
_______________________________________________
varnish-misc mailing list
[email protected]
<mailto:[email protected]>
https://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc
_______________________________________________
varnish-misc mailing list
[email protected]
https://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc