On 12/13/2012 08:01 PM, agentzh wrote:
> On Thu, Dec 13, 2012 at 3:16 AM, Antoine wrote:
>> Do you know if it is possible to change the default 301 redirect body of
>> nginx/openresty (which currently looks like the following one) so that
>> it includes the hyperlink to the new URI ?
>>
>
> Sure. Try this:
> ngx.status = 301
> ngx.header.location = new_url
> ngx.print(my_own_page)
> ngx.exit(301)
Thanks agentzh,
I kept having problems on my side because I was using ngx.say somewhere
when getting my new location. Therefore, ngx.header.location eventually
contained a line break character at the end and I got curl error
messages like "Received problem 2 in the chunky parser".
But now that I found the origin of the "problem", I used ngx.print and
everything's all good :)
Could you just tell how much the performances are impacted when using
this kind of redirect instead of the built-in one (ngx.redirect)?
Have a good day,
Antoine