forward TLD to www

Tim Dunphy bluethundr at gmail.com
Tue Nov 25 04:26:06 CET 2014


Ah, well the problem seems to be one I’ve been having for a little while now. I seem to be having some trouble caching the site because of the cookie headers we’re seeing from the app.

However I wasn’t 100% positive that the site had to be cached in order to perform a simple redirect. But I guess that’s the case… still early in the learning curve in my defense.

Here’s what I saw:

  11 TxURL        b /
   11 TxHeader     b Host: www.ref.mydomain.com
   11 TxHeader     b Accept-Encoding: gzip
   11 TxHeader     b CF-IPCountry: US
   11 TxHeader     b CF-RAY: 18eaa8c9918d0779-EWR
   11 TxHeader     b X-Forwarded-Proto: http
   11 TxHeader     b CF-Visitor: {"scheme":"http"}
   11 TxHeader     b Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8
   11 TxHeader     b User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.65 Safari/537.36
   11 TxHeader     b Accept-Language: en-US,en;q=0.8
   11 TxHeader     b Cookie: fbm_442804139174102=base_domain=.ref.mydomain.com; __cfduid=dfa49971056a2f2a4a2f881ef2e663a431416008779; PHPSESSID=mcltfa0qa3j2ih74cghnbjmbr6; cc_loggedin=0; fbsr_442804139174102=wXv6DlnzVYdng14lQgVjpgYou13ihkNUs52kSy0XJM0.eyJhbGdvcml0aG0iOiJITUFD
   11 TxHeader     b CF-Connecting-IP: 10.10.10.5
   11 TxHeader     b True-Client-IP: 0
   11 TxHeader     b X-Forwarded-For: 10.10.10.5, 10.10.10.6
   11 TxHeader     b X-Varnish: 286678851
   14 TxHeader     c Server: Apache/2.2.15 (CentOS)
   14 TxHeader     c X-Powered-By: PHP/5.6.3
   14 TxHeader     c Expires: Thu, 19 Nov 1981 08:52:00 GMT
   14 TxHeader     c Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
   14 TxHeader     c Content-Type: text/html; charset=UTF-8
   14 TxHeader     c Content-Length: 11391
   14 TxHeader     c Accept-Ranges: bytes
   14 TxHeader     c Date: Tue, 25 Nov 2014 03:11:29 GMT
   14 TxHeader     c X-Varnish: 286678851
   14 TxHeader     c Age: 0
   14 TxHeader     c Via: 1.1 varnish
   14 TxHeader     c Connection: close
   14 TxHeader     c X-Cache: MISS
   11 TxURL        b /cometchat/cometchat_receive.php
   11 TxHeader     b Host: www.ref.mydomain.com
   11 TxHeader     b Accept-Encoding: gzip
   11 TxHeader     b CF-IPCountry: US
   11 TxHeader     b CF-RAY: 18eaa8cf561c0779-EWR
   11 TxHeader     b Content-Length: 92
   11 TxHeader     b X-Forwarded-Proto: http
   11 TxHeader     b CF-Visitor: {"scheme":"http"}
   11 TxHeader     b Accept: */*
   11 TxHeader     b Origin: http://www.ref.mydomain.com
   11 TxHeader     b X-Requested-With: XMLHttpRequest
   11 TxHeader     b User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.65 Safari/537.36
   11 TxHeader     b Content-Type: application/x-www-form-urlencoded
   11 TxHeader     b Referer: http://www.ref.mydomain.com/
   11 TxHeader     b Accept-Language: en-US,en;q=0.8
   11 TxHeader     b Cookie: fbm_442804139174102=base_domain=.ref.mydomain.com; __cfduid=dfa49971056a2f2a4a2f881ef2e663a431416008779; PHPSESSID=mcltfa0qa3j2ih74cghnbjmbr6; cc_loggedin=0; fbsr_442804139174102=wXv6DlnzVYdng14lQgVjpgYou13ihkNUs52kSy0XJM0.eyJhbGdvcml0aG0iOiJITUFD
   11 TxHeader     b CF-Connecting-IP: 10.10.10.5
   11 TxHeader     b True-Client-IP: 0
   11 TxHeader     b X-Forwarded-For: 10.10.10.5, 10.10.10.6
   11 TxHeader     b X-Varnish: 286678852
   14 TxHeader     c Server: Apache/2.2.15 (CentOS)
   14 TxHeader     c X-Powered-By: PHP/5.6.3
   14 TxHeader     c Expires: Thu, 19 Nov 1981 08:52:00 GMT
   14 TxHeader     c Cache-Control: max-age=29030400
   14 TxHeader     c Content-Type: application/json; charset=utf-8
   14 TxHeader     c Content-Length: 17
   14 TxHeader     c Accept-Ranges: bytes
   14 TxHeader     c Date: Tue, 25 Nov 2014 03:11:30 GMT
   14 TxHeader     c X-Varnish: 286678852
   14 TxHeader     c Age: 0
   14 TxHeader     c Via: 1.1 varnish
   14 TxHeader     c Connection: close
   14 TxHeader     c X-Cache: MISS

Is there anything varnish can do to cope with these cookie headers?

Thanks
Tim


> On Nov 24, 2014, at 9:15 PM, Norberto Meijome <numard at gmail.com> wrote:
> 
> Doh...sorry didn't mean to email privately... Dumb phone.
> 
> On 24/11/2014 11:03 pm, "Norberto Meijome" <numard at gmail.com <mailto:numard at gmail.com>> wrote:
> Hey Tim,
> It seems you are replacing the http header of the request - your backend would see WWW.ref.mydomain . is this what you intend, or do you mean 'redirect the browser to www.ref.mydomain...' ?
> In what sub did you add this?
> 
> On 24/11/2014 10:52 pm, "Tim Dunphy" <bluethundr at gmail.com <mailto:bluethundr at gmail.com>> wrote:
> Hello,
> 
>  I'm trying to forward the top level domain for my site 'ref.mydomain.com <http://ref.mydomain.com/>' to the www version 'www.ref.mydomain.com <http://www.ref.mydomain.com/>'. 
>  
>  This is the logic I tried in my vcl_recv 
> 
>    if (req.http.host ~ "^ref\.mydomain\.com$") {
>        set req.http.host = "www.ref.mydomain.com <http://www.ref.mydomain.com/>";
> 
>     }
> 
> And after cycling the varnish service, there's no joy! Putting ref.mydomain.com <http://ref.mydomain.com/> doesn't forward to the other URL.
> 
> So maybe there's some problem with that statement that I'm missing?
> 
> I'd definitely appreciate any thoughts you might have.
> 
> Thanks!
> Tim
> 
> -- 
> GPG me!!
> 
> gpg --keyserver pool.sks-keyservers.net <http://pool.sks-keyservers.net/> --recv-keys F186197B
> 
> 
> _______________________________________________
> varnish-misc mailing list
> varnish-misc at varnish-cache.org <mailto:varnish-misc at varnish-cache.org>
> https://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc <https://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.varnish-cache.org/lists/pipermail/varnish-misc/attachments/20141124/62057636/attachment-0001.html>


More information about the varnish-misc mailing list