Www redirect

The website was configured to redirect the www version to the non www version.

  - canonical: site.com
      - www.site.com
    local_path: ../site

Meanwhile the client asked to make the www the default and remove the redirect, so I changed the settings to this and reprovisioned the server.

  - canonical: www.site.com
local_path: ../site

But it’s still redirecting site.com to www.site.com
If I curl the non www version it shows that there is indeed a 301 redirect to the www version

Is there anything I’m missing?

I noticed that Google Chrome browser caches these redirects, even after clearing the cache and other data, it has to be actually restarted. For testing redirects you could use a command line tool without preserving any state between requests. I use Mozilla Firefox Developer edition for testing complex redirects because it doesn’t cache them until restart.

@strarsis is right; Chrome aggressively and annoyingly caches redirects. But if you’re curling the non-www address and it’s showing a 301 redirect then something still isn’t right: the client request was to remove the non-www spelling from the site entirely right?

Yes, that was their request. I already checked, it’s not just Chrome.
Doing curl -I site.com returns HTTP/1.1 301 Moved Permanently

The servers are on their side, and they say they have no redirect configured on their end. That’s why I’m wondering if there is anything I’m overlooking with my Trellis setup.

Is the WordPress site URL correctly configured, with www.?

Yes it is, and it resolves correctly.

What specifically did you do to reprovision the server?

If you didn’t try this already, run server.yml with the nginx and wordpress tags, plus the letsencrypt tag if you’re using letsencrypt:

 $ ansible-playbook server.yml -e env=production --tags "nginx, wordpress, letsencrypt"

Just be aware that for some people, nginx service doesn’t survive restart so you may need to start it manually after running server.yml.