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

reverse_www filter not working from www to non-www #569

Closed
3 of 4 tasks
ssnepenthe opened this issue Apr 17, 2016 · 2 comments
Closed
3 of 4 tasks

reverse_www filter not working from www to non-www #569

ssnepenthe opened this issue Apr 17, 2016 · 2 comments

Comments

@ssnepenthe
Copy link

Submit a feature request or bug report

  • This is a feature request
  • This is a bug report
  • This request isn't a duplicate of an existing issue
  • I've read the docs and followed them (if applicable)

Replace any X with your information.


What is the current behavior?

With a www domain set in site_hosts, the reverse_www filter seems to be returning the unmodified domain.

What is the expected or desired behavior?

Unless I am completely misunderstanding it, reverse_www should be returning the non-www version of the domain.


Bug report

(delete this section if not applicable)

Please provide steps to reproduce, including full log output:

Get latest trellis and bedrock:

$ mkdir www.testsite.com && cd www.testsite.com
$ git clone --depth=1 git@github.com:roots/trellis.git && rm -rf trellis/.git
$ git clone --depth=1 git@github.com:roots/bedrock.git site && rm -rf site/.git
$ cd trellis && ansible-galaxy install -r requirements.yml

edit group_vars/development/wordpress_sites.yml:

wordpress_sites:
  www.testsite.com:
    site_hosts:
      - www.testsite.dev
    local_path: ../site # path targeting local Bedrock site directory (relative to Ansible root)
    admin_email: admin@testsite.dev
    multisite:
      enabled: false
    ssl:
      enabled: true
      provider: self-signed
    cache:
      enabled: false

And group_vars/development/vault.yml:

vault_wordpress_sites:
  www.testsite.com:
    admin_password: admin
    env:
      db_password: example_dbpassword

Provision dev server:

$ vagrant up

Inspect nginx config:

$ vagrant ssh
$ cat /etc/nginx/sites-available/www.testsite.com.conf

Note the server_name in the last two server blocks:

server {
    listen 80;

    server_name www.testsite.dev;

    return 301 https://$host$request_uri;
}

Expected server name is www.testsite.dev testsite.dev.

server {
    listen 443 ssl http2;

    include h5bp/directive-only/ssl.conf;
    include h5bp/directive-only/ssl-stapling.conf;

    ssl_dhparam /etc/nginx/ssl/dhparams.pem;
    ssl_buffer_size 1400; # 1400 bytes to fit in one MTU

    add_header Strict-Transport-Security "max-age=31536000; includeSubdomains; preload";

    ssl_certificate         /etc/nginx/ssl/www.testsite.com.cert;
    ssl_trusted_certificate /etc/nginx/ssl/www.testsite.com.cert;
    ssl_certificate_key     /etc/nginx/ssl/www.testsite.com.key;

    server_name www.testsite.dev;

    return 301 $scheme://www.testsite.dev$request_uri;
}

Expected server name is testsite.dev.

Please describe your local environment:

Ansible version: 2.0.1.0

OS: OS X 10.11.4

Vagrant version: 1.8.1

Where did the bug happen? Development or remote servers?

Development, untested on remote servers.

Please provide a repository or your wordpress_sites config (if possible):

See steps to reproduce above, no other changes made to base repo aside from wordpress_sites config.

Is there a related Discourse thread or were any utilized (please link them)?

Nothing I could find.

@swalkinshaw
Copy link
Member

Thanks for the awesome bug report!

Your understanding of reverse_www is correct. I (now) very obviously broke this in #525.

Just opened a PR which should fix this: #570

swalkinshaw added a commit that referenced this issue Apr 17, 2016
Fix #569 Only skip subdomains for non-www domains
@ssnepenthe
Copy link
Author

Glad to help in whatever little way I can, and thanks for the quick fix!

I have known about this project for a while but only just trying it out for the first time now. You guys are doing some awesome work over here - thanks for this amazing tool!

primozcigler added a commit to proteusthemes/pt-ops that referenced this issue Apr 29, 2016
* trellis/master: (109 commits)
  Update salts link to roots.io version
  Fix roots#569 Only skip subdomains for non-www domains
  Define development default for Let's Encrypt variable
  Enable Let's Encrypt to transition http sites to https
  Add 'reason' to attr extracted for pretty-print
  Adding dbus to essentials
  Pass vault cli args to remote-user ping task
  Tidy up sudoer password definitions and comments
  👮 Fix ssmtp role tags
  0.9.7
  Fix ansible.cfg and Ansible plugins for moved Vagrantfile
  Tidy up output.py by moving some methods to utils
  Add issue template
  Update version check for Ansible 2.x
  Fix roots#550 - Properly skip permalink setup for MU
  Escape salts and keys to avoid templating errors
  Display system info with fail output
  Add plugin to pretty print Ansible msg output
  Suppress sudo warning
  Fix roots#482 - Multisite is-installed deploy check
  ...

Conflicts:
	.gitignore
	.travis.yml
	CHANGELOG.md
	README.md
	Vagrantfile
	ansible.cfg
	deploy.sh
	deploy.yml
	dev.yml
	group_vars/all/mail.yml
	group_vars/all/main.yml
	group_vars/all/security.yml
	group_vars/all/users.yml
	group_vars/development/wordpress_sites.yml
	group_vars/production/wordpress_sites.yml
	group_vars/staging/main.yml
	group_vars/staging/wordpress_sites.yml
	hosts/development
	hosts/production
	hosts/staging
	requirements.yml
	roles/common/handlers/main.yml
	roles/common/tasks/main.yml
	roles/composer/tasks/main.yml
	roles/deploy/defaults/main.yml
	roles/deploy/hooks/build-after.yml
	roles/deploy/hooks/finalize-after.yml
	roles/deploy/tasks/build.yml
	roles/deploy/tasks/finalize.yml
	roles/deploy/tasks/initialize.yml
	roles/deploy/tasks/main.yml
	roles/deploy/tasks/prepare.yml
	roles/deploy/tasks/share.yml
	roles/deploy/tasks/update.yml
	roles/deploy/templates/env.j2
	roles/mariadb/defaults/main.yml
	roles/memcached/defaults/main.yml
	roles/memcached/tasks/main.yml
	roles/memcached/templates/memcached.conf.j2
	roles/php/tasks/main.yml
	roles/remote-user/tasks/main.yml
	roles/rollback/tasks/main.yml
	roles/rollback/tasks/prior-release.yml
	roles/rollback/tasks/user-release.yml
	roles/users/tasks/main.yml
	roles/wordpress-install/tasks/directories.yml
	roles/wordpress-install/tasks/main.yml
	roles/wordpress-setup/tasks/main.yml
	roles/wordpress-setup/templates/wordpress-site.conf.j2
	roles/wp-cli/defaults/main.yml
	rollback.yml
	server.yml
	variable-check.yml
primozcigler added a commit to proteusthemes/pt-ops that referenced this issue May 18, 2016
* new-sbs: (125 commits)
  Changed remote path for XML back to xml-exports.
  Added php-imagick. Closing #3.
  Fixing the YAML syntax error from previous commit.
  Fixed the format of the sandbox-local role.
  Fixed xml remote path (no ending slash).
  Added back cron to server-sandbox.yml.
  Added back inventory group sandbox_internal - for group vars.
  Added to install the sandbox sites.
  New remote path for xmls on as.
  Added IP of the new sbs4 machine.
  Renamed name of the devbox from default to local_as.
  Debugged vagrant-hostmanager.
  Up to date static-sites-setup role.
  Fixed the name of the site in dev vault_wordpress_sites.
  Fixed deprecated sudo to become.
  Removed memcached from dev.yml.
  Update salts link to roots.io version
  Fix roots#569 Only skip subdomains for non-www domains
  Define development default for Let's Encrypt variable
  Enable Let's Encrypt to transition http sites to https
  ...
jawngee added a commit to jawngee/trellis that referenced this issue May 22, 2016
* commit 'f1c4fb72009906244f512e82bb02c2f9435dbed0': (52 commits)
  Add Nginx variable to set fastcgi_buffer_size (roots#586)
  Require Ansible 2.0.2 and remove deploy_helper
  Pass cli options to user role's admin_user ping test
  Add connection-related cli options to ping command
  Wrap my.cnf password in quotes
  Update to WP-CLI v0.23.1
  Fix roots#563 - Improve remote databases
  Update salts link to roots.io version
  Fix roots#569 Only skip subdomains for non-www domains
  Define development default for Let's Encrypt variable
  Enable Let's Encrypt to transition http sites to https
  Add 'reason' to attr extracted for pretty-print
  Adding dbus to essentials
  Pass vault cli args to remote-user ping task
  Tidy up sudoer password definitions and comments
  👮 Fix ssmtp role tags
  0.9.7
  Fix ansible.cfg and Ansible plugins for moved Vagrantfile
  Enable color output for Vagrant shell provisioner windows.sh
  Tidy up output.py by moving some methods to utils
  ...

# Conflicts:
#	roles/deploy/defaults/main.yml
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

No branches or pull requests

2 participants