Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

iterate server_name when rewrite_www_to_non_www is used #683

Merged
merged 2 commits into from
Sep 16, 2015

Conversation

kronos-pbrideau
Copy link
Contributor

Was not working when server_name was an array

with

server_name            => [ 'a.example.com', 'b.example.org' ],
rewrite_www_to_non_www => true,

Before patch:

server {
  [...]
  server_name www.a.example.com;
  return 301 http://a.example.com$request_uri; 
}
[...]
server {
  [...]
  servername a.example.com
  [...]
}

now:

server {
  [...]
  server_name www.a.example.com;
  return 301 http://a.example.com$request_uri; 
}
server {
  [...]
  server_name www.b.example.org;
  return 301 http://b.example.org$request_uri; 
}

[...]
server {
  [...]
  servername a.example.com b.example.org
  [...]
}

@kronos-pbrideau
Copy link
Contributor Author

Was it intended to show only the first server of the list? The comment in the tests suggest it is intended, but I don't understand the reason...

in the spec file:
should set the server_name of the rewrite server stanza to the first server_name with 'www.' stripped"

I don't seem to be the only one to detect this bug though: #381

@kalmanolah beeing the one who submit PR #310 do you see something bad about my PR?

@kalmanolah
Copy link
Contributor

@kronos-pbrideau The PR looks alright to me. How I missed/ignored the fact that only the first server name was being handled is still a mystery to me. Thanks for the fix 👍

@3flex
Copy link
Contributor

3flex commented Sep 16, 2015

@kalmanolah thanks for reviewing!

3flex added a commit that referenced this pull request Sep 16, 2015
iterate server_name when rewrite_www_to_non_www is used
@3flex 3flex merged commit 1860f92 into voxpupuli:master Sep 16, 2015
Slm0n87 pushed a commit to Slm0n87/puppet-nginx that referenced this pull request Mar 7, 2019
…n_www

iterate server_name when rewrite_www_to_non_www is used
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants