Accept-Language Issue

Andrey Nepomnyaschih rednasy at gmail.com
Thu Jul 8 03:45:06 CEST 2010


Ken, Laurence thank you.

It was indeed my typo.

On Thu, Jul 1, 2010 at 5:37 PM, Laurence Rowe <l at lrowe.co.uk> wrote:

> Check that you do have the comma in Plone's caching control panel. I can
> imagine it being an easy typo to make.
>
> There are many unique variations of Accept-Language headers, so be careful.
> I've used this before in vcl_recv to normalise the incoming request:
>
>   # We only care about the language in the I18N_LANGUAGE cookie
>   if (req.http.Cookie ~ "(^|.*; )I18N_LANGUAGE=") {
>     set req.http.Accept-Language = regsub(req.http.Cookie, "(^|.*;
> )I18N_LANGUAGE=([^;]*)(; .*|$)", "\2");
>     # XXX need to work out the proper way to match " here, e.g. "en"
>     set req.http.Accept-Language = regsub(req.http.Accept-Language,
> "^.(.*).$", "\1");
>   } else {
>     set req.http.Accept-Language = "en";
>   }
>
> Laurence
>
> On 1 July 2010 22:04, Ken Brownfield <kb+varnish at slide.com<kb%2Bvarnish at slide.com>
> > wrote:
>
>> I do notice that the Vary header is malformed:
>>
>> Vary: User-Agent Accept-Language
>>
>> It should be comma-separated AFAIK.  Also, all of the lines from your last
>> header dump have appended periods... not sure that's the actual output or
>> just a paste glitch.
>>
>> Perhaps Varnish is being very strict about malformed headers and dumping
>> the connection immediately.  Which is probably a good thing, if true.
>>  --
>> Ken
>>
>> On Jul 1, 2010, at 1:54 PM, Andrey Nepomnyaschih wrote:
>>
>> Hello,
>>
>> Can somebody give me a hint for what am I doing wrong with my setup. I
>> have Zope instance that is proxied by nginx (doing address rewriting) that I
>> want to be cached by varnish, but as soon as I configure Zope to add
>> Accept-Language to Vary header, varnish starts closing connection when asked
>> for object from Zope without returning any data. I'm using default.vcl
>>
>> Using tcpdump doesn't reveal anything useful, the only difference is
>> Accept-Language value in Vary header.
>>
>> Request that works:
>>
>> # GET -H "Host: hostname.domain.tld" -Used http://hostname.domain.tld
>> GET http://hostname.domain.tld
>> Host: hostname.domain.tld
>> User-Agent: lwp-request/5.834 libwww-perl/5.836
>>
>> 200 OK
>> Wide character in print at /usr/local/bin/GET line 439.
>> Cache-Control: max-age=0, s-maxage=0, private, must-revalidate
>> Connection: close
>> Date: Thu, 01 Jul 2010 20:30:22 GMT
>> Via: 1.1 varnish
>> Age: 0
>> ETag: ||Plone Default||0|181||||355004
>> Server: nginx/0.7.67
>> Vary: User-Agent
>> Content-Language: en
>> Content-Length: 5485
>> Content-Type: text/html;charset=utf-8
>> Expires: Mon, 03 Jul 2000 20:30:22 GMT
>> Client-Date: Thu, 01 Jul 2010 20:30:22 GMT
>> Client-Peer: 82.103.128.123:80
>> Client-Response-Num: 1
>> Content-Base: http://hostname.domain.tld/plonesite/front-page
>> Imagetoolbar: no
>> Link: <http://hostname.domain.tld/plonesite/front-page>;
>> rel="kss-base-url"
>> Link: <
>> http://hostname.domain.tld/plonesite/portal_kss/Plone%20Default/at-cachekey6690.kss>;
>> rel="kinetic-stylesheet"; type="text/css"
>> Link: <http://hostname.domain.tld/plonesite/favicon.ico>; rel="shortcut
>> icon"; type="image/x-icon"
>> Link: <http://hostname.domain.tld/plonesite>; rel="home"; title="Front
>> page"
>> Link: <http://hostname.domain.tld/plonesite/sitemap>; rel="contents";
>> title="Site Map"
>> Link: <http://hostname.domain.tld/plonesite/search_form>; rel="search";
>> title="Search this site"
>> Title: Plone Site!
>> X-Cache-Headers-Set-By: CachingPolicyManager:
>> /plonesite/caching_policy_manager
>> X-Caching-Rule-Id: plone-content-types
>> X-Header-Set-Id: cache-in-memory
>> X-Meta-Generator: Plone - http://plone.org
>> X-Pagecache: MISS
>> X-UA-Compatible: IE=edge
>> X-Varnish: 1366563744
>>
>> Results in the following request to nginx:
>>
>> 2010/07/01 22:30:22.196300 127.0.0.1:25266 -> 127.0.0.1:8080 [AP]
>> GET / HTTP/1.1.
>> Host: hostname.domain.tld.
>> User-Agent: lwp-request/5.834 libwww-perl/5.836.
>> X-Forwarded-For: 82.103.128.123.
>> X-Varnish: 1366563744.
>>
>> And the following reply from nginx:
>>
>> T 2010/07/01 22:30:22.267204 127.0.0.1:8080 -> 127.0.0.1:25266 [AP]
>> HTTP/1.1 200 OK.
>> Server: nginx/0.7.67.
>> Date: Thu, 01 Jul 2010 20:30:22 GMT.
>> Content-Type: text/html;charset=utf-8.
>> Connection: keep-alive.
>> X-Pagecache: MISS.
>>  Content-Length: 5485.
>> Content-Language: en.
>> X-Cache-Headers-Set-By: CachingPolicyManager:
>> /plonesite/caching_policy_manager.
>> Expires: Mon, 03 Jul 2000 20:30:22 GMT.
>> Vary: User-Agent.
>> ETag: ||Plone Default||0|181||||355004.
>> X-Caching-Rule-Id: plone-content-types.
>> Cache-Control: max-age=0, s-maxage=0, private, must-revalidate.
>> X-Header-Set-Id: cache-in-memory.
>>
>> Request that doesn't work:
>>
>> [root at rain /usr/local/etc/varnish]# GET -H "Host: hostname.domain.tld"
>> -Used http://hostname.domain.tld
>> GET http://hostname.domain.tld
>> Host: hostname.domain.tld
>> User-Agent: lwp-request/5.834 libwww-perl/5.836
>>
>> 500 Server closed connection without sending any data back
>> Content-Type: text/plain
>> Client-Date: Thu, 01 Jul 2010 20:27:54 GMT
>> Client-Warning: Internal response
>>
>> Results in the following request to nginx:
>>
>> 2010/07/01 22:27:54.507294 127.0.0.1:50795 -> 127.0.0.1:8080 [AP]
>> GET / HTTP/1.1.
>> Host: hostname.domain.tld.
>> User-Agent: lwp-request/5.834 libwww-perl/5.836.
>> X-Forwarded-For: 82.103.128.123.
>> X-Varnish: 1656652273.
>>
>> And the following reply from nginx:
>>
>> 2010/07/01 22:27:54.573671 127.0.0.1:8080 -> 127.0.0.1:50795 [AP]
>> HTTP/1.1 200 OK.
>> Server: nginx/0.7.67.
>> Date: Thu, 01 Jul 2010 20:27:54 GMT.
>> Content-Type: text/html;charset=utf-8.
>> Connection: keep-alive.
>> X-Pagecache: MISS.
>> Content-Length: 5485.
>> Content-Language: en.
>> X-Cache-Headers-Set-By: CachingPolicyManager:
>> /plonesite/caching_policy_manager.
>> Expires: Mon, 03 Jul 2000 20:27:54 GMT.
>> Vary: User-Agent Accept-Language.
>> ETag: ||Plone Default||0|180||||355004.
>> X-Caching-Rule-Id: plone-content-types.
>> Cache-Control: max-age=0, s-maxage=0, private, must-revalidate.
>> X-Header-Set-Id: cache-in-memory.
>>
>> Kind Regards,
>> Andrey Nepomnyaschih
>>  _______________________________________________
>> varnish-misc mailing list
>> varnish-misc at varnish-cache.org
>> http://lists.varnish-cache.org/mailman/listinfo/varnish-misc
>>
>>
>>
>> _______________________________________________
>> varnish-misc mailing list
>> varnish-misc at varnish-cache.org
>> http://lists.varnish-cache.org/mailman/listinfo/varnish-misc
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.varnish-cache.org/pipermail/varnish-misc/attachments/20100707/93c4c3c1/attachment-0001.html>


More information about the varnish-misc mailing list