Redirect Directly to Primary Domain for Domain Aliases with SSL instead of 2 hops

When a typical domain is setup with a redirect domain alias with SSL, Netlify will redirect the bare HTTP alias call to HTTPS on same alias domain and then redirect to the primary. This results in 2 hops and various search engines penalize on this behavior.

Netlify Settings
www.example.com – Primary Domain
example.com – Redirects automatically to primary domain

HTTPS Settings
Domains: example.com, www.example.com


Since I can’t post more than 6 links the following has brackets for emphasis.

CURRENT BEHAVIOR: [http]://example.com → [https]://example.com → [https]://www.example.com

REQUESTED BEHAVIOR: [http]://example.com → [https]://www.example.com

Hey @webghost!

Thanks for the feature request! Just to add a bit of context for when the official Netlify team comes around to catalog the request, do you have any resources or documentation noting specifically that this dual-hop is indeed a poor index marker for SEO? Particularly because both hops come back as a 301 (should never need to be repeated by that actor again in time) and both are super valid web parlance changes, the first to note a secure connection (to Netlify’s platform, really), the second to fetch a different location / subdomain.

I also wonder how impactful this particular case is given that probably 95% of the public URLs shown for a given website are written by the site owners — unless you’re as big as Facebook. I mean to say that Google’s going to follow links all over the web and if the site owner is out writing links to their site without the www. even though their site uses the www. they should stop doing that :stuck_out_tongue: e.g. make sure content matches the actual site that way you reduce the number of public links out in the wild that will force that second jump by already specifying the correct subdomain (or lack thereof - don’t write www.example.com if your site is simply example.com).

Looking forward to improvements for all!


Jon

1 Like

Hi there. Yes, this is a very low priority issue and impacts very little; however, it does come up.

There’s a lot of documentation about this issue and performance hits on their indexing when using the “Moz Pro” site optimizer. In general, regardless of the permanent 301 redirect, the issue is in regards to first-time behavior speed perception. (2 hops instead of 1)

And yes, this isn’t about really external linking… just fixing the exact 2-hop for the rare HTTP unprefixed alias domain request.

In Nginx/Apache it’s super easy to handle this … not sure how Netlify does it on the backend, but I’m assuming it would be super easy to just detect this case and just avoid the extra 301.

-Mark

All good points and please know that I’m not attempting to reduce your argument, just provide more context for the ensuing Feature Request that will hit the Netlify backlog (more context = better chance for implementation).

That said, the Netlify request / redirection pipeline is definitely not simple so I can’t speak to how easy or hard this will be. :confused: Anyway, this post being in the #features category should itself get a response from Netlify directly and I’ll go ahead and leave it there until then :smiley:

1 Like

Hi, @webghost.

Yes, it might seem easy but I assure you it is not. There is a whole mess of nitty gritty details behind the scenes and making this change isn’t nearly as simple as one might expect.

That being said, meaning hard to implement or not, this is a great idea and I would also love to see us make this change. :wink: :+1:

I’ve entered a feature request with this exact example you provided. I did make the feature request for “the general case” where any chain of 301 redirects on a single site should be shortened to return the location which is known to return the 200 response.

If or when this feature becomes available (or more likely becomes the new default behavior) we will post an update here to let you know about it. If there are other questions or concerns, please let us know.

P.S. Kudos to you for using example.com as the example. As you likely already know, that domain was designated precisely to be used for this. It is the right domain name to use when no “real” domain exist but one is needed for an example.

1 Like

Thanks @luke - I appreciate the positive feedback for this performance tweak (even ones like this that are relatively minor). Looking forward to future updates. And once implemented I can definitely help confirm as I have a few Netlify sites setup this way. Cheers

1 Like

Hi there!
This feature request is also something I’d really like for my site. Has there been any movement on this in the last year? @luke

Hi, @esilver. In the time since this topic was created I have learned more about the reason for this behavior:

The current double hop behavior is actually a requirement for a domain to be added to Chome’s HTTP Strict Transport Security (HSTS ) preload list. There is more information about this here:

https://hstspreload.org/

Quoting that page:

  1. Redirect from HTTP to HTTPS on the same host, if you are listening on port 80.

That requirement above is saying that you must redirect from HTTP to HTTPS without changing the domain name. Only once the HTTP to HTTPS redirect is completed can the domain name be changed (which is done using the second redirect from the apex to the www subdomain).

So, while there is a feature request for this, it is also unlikely for this behavior to ever change - as changing it would break the HSTS requirement above.

If there are other questions about this, please let us know.

1 Like