Old Android browser sending through some UPPER case in the host field... And erroring...

Clark Mills c.mills at auckland.ac.nz
Fri Oct 24 03:23:06 CEST 2014


Hi all.

We're getting an error...

     Error 503 Backend fetch failed Guru Meditation: XID: 123456 Varnish 
cache server

...when going to a site we host, http://Example.com/ when using an old 
mobile device (GT-S5660).  If we get the browser to lowercase the 
hostname: http://example.com/ then everything behaves.

Is there a way to make it so that the hostname is forced lowercase?  I 
recognise that there might be a slight performance cost.



File: varnish.log
*   << BeReq    >> 328010
-   Begin          bereq 328009 pass
-   Timestamp      Start: 1414100695.527676 0.000000 0.000000
-   BereqMethod    GET
-   BereqURL       /
-   BereqProtocol  HTTP/1.1
-   BereqHeader    Host: Example.com
-   BereqHeader    Accept-Encoding: gzip
-   BereqHeader    Accept-Language: en-NZ, en-US
-   BereqHeader    x-wap-profile: 
http://wap.samsungmobile.com/uaprof/GT-S5660.xml
-   BereqHeader    User-Agent: Mozilla/5.0 (Linux; U; Android 2.3.6; 
en-nz; GT-S5660 Build/GINGERBREAD) AppleWebKit/533.1 (KHTML, like Gecko) 
Version/4.0 Mobile Safari/533.1
-   BereqHeader    Cookie: 
SESS9f2bcbf4975f5536ef0daf298ed65496=5hrnD05HnvODku5BDRk2L_uu-L4GP0PcrGXEpYC5tqw; 
has_js=1
-   BereqHeader    Accept: 
application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5
-   BereqHeader    Accept-Charset: utf-8, iso-8859-1, utf-16, *;q=0.7
-   BereqHeader    X-Forwarded-For: 172.24.75.241
-   BereqHeader    X-Varnish: 328010
-   VCL_call       BACKEND_FETCH
-   VCL_return     fetch
-   FetchError     no backend connection
-   Timestamp      Beresp: 1414100695.527838 0.000162 0.000162
-   Timestamp      Error: 1414100695.527847 0.000171 0.000009
-   BerespProtocol HTTP/1.1
-   BerespStatus   503
-   BerespReason   Service Unavailable
-   BerespReason   Backend fetch failed
-   BerespHeader   Date: Thu, 23 Oct 2014 21:44:55 GMT
-   BerespHeader   Server: Varnish
-   VCL_call       BACKEND_ERROR
-   BerespHeader   Content-Type: text/html; charset=utf-8
-   BerespHeader   Retry-After: 5
-   VCL_return     deliver
-   Storage        malloc Transient
-   ObjProtocol    HTTP/1.1
-   ObjStatus      503
-   ObjReason      Backend fetch failed
-   ObjHeader      Date: Thu, 23 Oct 2014 21:44:55 GMT
-   ObjHeader      Server: Varnish
-   ObjHeader      Content-Type: text/html; charset=utf-8
-   ObjHeader      Retry-After: 5
-   Length         418
-   BereqAcct      0 0 0 0 0 0
-   End




I tried being clever and attepmted tolower but it just hung for me.  I 
probably am showing my naivety...
It compiled so it must be correct!  :)

File: default.vcl
import std;
...
sub vcl_recv {
        set req.http.host = std.tolower(req.http.host);
}




Many thanks...  Clark




More information about the varnish-misc mailing list