Mailing List Archive

Simple redirect to correct a URL
I'm sure I must be doing something hair-brained ... shouldn't this work in V5?

if (req.url~ "^/type/news?$") {
return (synth (750,"http://" + req.http.Host + "/news/"));
}
Re: Simple redirect to correct a URL [ In reply to ]
Not to beat my own drum, but I blogged about this recently:
https://info.varnish-software.com/blog/rewriting-urls-with-varnish-redirection

TL;DR: you need a 30X return code, and to put the new URL in the correct
header (location).

On Jan 6, 2017 02:06, "Kari Cowan" <KCowan@alm.com> wrote:

> I’m sure I must be doing something hair-brained … shouldn’t this work in
> V5?
>
>
>
> if (req.url~ "^/type/news?$") {
>
> return (synth (750,"http://" + req.http.Host + "/news/"));
>
> }
>
> _______________________________________________
> varnish-dev mailing list
> varnish-dev@varnish-cache.org
> https://www.varnish-cache.org/lists/mailman/listinfo/varnish-dev
>
Re: Simple redirect to correct a URL [ In reply to ]
And I just noticed, please use varnish-misc for this kind of requests,
varnish-dev is for dev topics only.

On Jan 6, 2017 09:14, "Guillaume Quintard" <guillaume@varnish-software.com>
wrote:

> Not to beat my own drum, but I blogged about this recently: https://info.
> varnish-software.com/blog/rewriting-urls-with-varnish-redirection
>
> TL;DR: you need a 30X return code, and to put the new URL in the correct
> header (location).
>
> On Jan 6, 2017 02:06, "Kari Cowan" <KCowan@alm.com> wrote:
>
>> I’m sure I must be doing something hair-brained … shouldn’t this work in
>> V5?
>>
>>
>>
>> if (req.url~ "^/type/news?$") {
>>
>> return (synth (750,"http://" + req.http.Host + "/news/"));
>>
>> }
>>
>> _______________________________________________
>> varnish-dev mailing list
>> varnish-dev@varnish-cache.org
>> https://www.varnish-cache.org/lists/mailman/listinfo/varnish-dev
>>
>
RE: Simple redirect to correct a URL [ In reply to ]
Thanks – I will move any followup questions over to the misc list. That’s a great article – just wanted to say.


From: Guillaume Quintard [mailto:guillaume@varnish-software.com]
Sent: Friday, January 06, 2017 12:15 AM
To: Kari Cowan <KCowan@alm.com>
Cc: Varnish Development <varnish-dev@varnish-cache.org>
Subject: Re: Simple redirect to correct a URL

Not to beat my own drum, but I blogged about this recently: https://info.varnish-software.com/blog/rewriting-urls-with-varnish-redirection

TL;DR: you need a 30X return code, and to put the new URL in the correct header (location).

On Jan 6, 2017 02:06, "Kari Cowan" <KCowan@alm.com<mailto:KCowan@alm.com>> wrote:
I’m sure I must be doing something hair-brained … shouldn’t this work in V5?

if (req.url~ "^/type/news?$") {
return (synth (750,"http://" + req.http.Host + "/news/"));
}

_______________________________________________
varnish-dev mailing list
varnish-dev@varnish-cache.org<mailto:varnish-dev@varnish-cache.org>
https://www.varnish-cache.org/lists/mailman/listinfo/varnish-dev