forward TLD to www
Tim Dunphy
bluethundr at gmail.com
Tue Nov 25 03:56:15 CET 2014
Hey Norberto,
OK thanks for clarifying that. I put this statement into my sub vcl_recv
hoping to redirect the web browser from ref.mydomain.com to
www.ref.mydomain.com
So from what you're telling me, only the backend sees this translation.
On my next attempt I tried setting an error in sub vcl_recv and then
passing that error to sub vcl_error. Like so:
In sub vcl_recv I have this:
if (req.http.host ~ "^ref\.mydomain\.com$") {
error 750 "Moved Permanently";
}
Then I created a sub_vcl error like so:
sub vcl_error {
if (obj.status == 750) {
set obj.http.Location = "http://www.ref.mydomain.com";
set obj.status = 301;
return(deliver);
}
}
Still no luck. The page is not redirecting in the browser. Any other
thoughts?
Thanks
Tim
On Mon, Nov 24, 2014 at 9:09 PM, Tim Dunphy <bluethundr at gmail.com> wrote:
> Hey Norberto,
>
>
> OK thanks for clarifying that. I put this statement into my sub vcl_recv
> hoping to redirect the web browser from ref.mydomain.com to
> www.ref.mydomain.com
>
> So from what you're telling me, only the backend sees this translation.
> How do I achieve what I want with redirecting the browser from one URL to
> another?
>
> Thanks
> Tim
>
> On Mon, Nov 24, 2014 at 9:03 PM, Norberto Meijome <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> wrote:
>>
>>> Hello,
>>>
>>> I'm trying to forward the top level domain for my site '
>>> ref.mydomain.com' to the www version '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";
>>>
>>> }
>>> And after cycling the varnish service, there's no joy! Putting
>>> 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 --recv-keys F186197B
>>>
>>>
>>> _______________________________________________
>>> varnish-misc mailing list
>>> varnish-misc at varnish-cache.org
>>> https://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc
>>>
>>
>
>
> --
> GPG me!!
>
> gpg --keyserver pool.sks-keyservers.net --recv-keys F186197B
>
>
--
GPG me!!
gpg --keyserver pool.sks-keyservers.net --recv-keys F186197B
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.varnish-cache.org/lists/pipermail/varnish-misc/attachments/20141124/e7540dbb/attachment-0001.html>
More information about the varnish-misc
mailing list