Welcome! Log In Create A New Profile

Advanced

Re: remove www from the url

Francis Daly
February 17, 2011 06:46PM
On Thu, Feb 17, 2011 at 03:51:33PM +0000, Francis Daly wrote:

Hi there,

> But it looks to me as if the behaviour you see is to be expected, based
> on the documentation you quote:

[from http://wiki.nginx.org/HttpRewriteModule#rewrite ]

"""
Note that if a redirect is relative (has no host part), then when
redirecting Nginx uses the "Host" header if the header match name of
server_name directive or the first name of server_name directive, if
the header does not match or is absent. If no server_name is set, then
the local hostname is used. If you want Nginx to always use the "Host"
header, you can use a wildcard "*" server_name (but see the restrictions
on doing so).
"""

> Other than a little bit of grammar, the documentation looks correct.

Actually, now that I look at it again and actually *test*, I believe
this documentation is wrong -- at least as it relates to 0.9.4.

Reality seems to be more like

"""
Note that if a redirect is relative (has no host part),
then Nginx generates the host part based on the value of
(./HttpCoreModule#server_name_in_redirect) server_name_in_redirect,
which now defaults to "off".
"""

That linked documentation says

"""
If server_name_in_redirect is on, then Nginx will use the first value
of the server_name directive for redirects. If server_name_in_redirect
is off, then nginx will use the requested Host header.
"""

which is true, but an extra note like "if the first value of the
server_name directive used is not a plain hostname, then generated
redirects are not likely to be useful" might warn people against blindly
setting server_name_in_redirect on.

Could someone with wiki access verify that and update the pages?

Cheers,

f
--
Francis Daly francis@daoine.org

_______________________________________________
nginx mailing list
nginx@nginx.org
http://nginx.org/mailman/listinfo/nginx
Subject Author Posted

remove www from the url

whiskybar February 17, 2011 09:44AM

Re: remove www from the url

Jim Ohlstein February 17, 2011 09:52AM

Re: remove www from the url

edogawaconan February 17, 2011 09:52AM

Re: remove www from the url

Luit van Drongelen February 17, 2011 09:54AM

Re: remove www from the url

Dayo February 17, 2011 10:03AM

Re: remove www from the url

Jim Ohlstein February 17, 2011 10:12AM

Re: remove www from the url

Dayo February 17, 2011 10:34AM

Re: remove www from the url

whiskybar February 17, 2011 10:08AM

Re: remove www from the url

Igor Sysoev February 17, 2011 10:18AM

Re: remove www from the url

Francis Daly February 17, 2011 10:54AM

Re: remove www from the url

whiskybar February 17, 2011 11:15AM

Re: remove www from the url

Francis Daly February 17, 2011 06:46PM

Re: remove www from the url

lifeisjustabout February 17, 2011 11:31PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 172
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready