Domain-level redirects failing despite being processed without errors

Hi folks, our first post on here!

Would really appreciate any help with a redirect problem we’ve been having - have searched in this tag but not turned up anything that’s helped so far.

We have a site up and running on a custom domain at https://musafespace.org.uk (we haven’t launched the site yet so please don’t put it around), and the same site served with a .co.uk TLD as well. We sorted that out ages ago, so we’re not waiting on DNS propagation or anything.

In addition to the usual 404 handling (i.e. redirecting to home) we want any traffic to the Netlify subdomain or to .co.uk to be forcibly 301 redirected to the .org.uk address, and have followed Netlify’s (excellent) relevant docs to the letter, as far as we can tell.

So we have the appropriate rules in the netlify.toml file at the root of the project. For example, the first two read:

[[redirects]]
  from = "/*"
  to = "/index.html"
  status = 200

[[redirects]]
  from = "https://www.musafespace.co.uk/*"
  to = "https://www.musafespace.org.uk/:splat"
  status = 301
  force = true

And we have the same rules in a _redirects_ file which ends up in the build folder (we’re running React). According to Netlify this should take priority, but since they’re the same rules it shouldn’t matter either way. The full set looks like this:

/* /index.html 200
https://www.musafespace.co.uk/* https://www.musafespace.org.uk/:splat 301!
https://musafespace.co.uk/* https://www.musafespace.org.uk/:splat 301!
https://www.musafespace.netlify.com/* https://www.musafespace.org.uk/:splat 301!
https://www.musafespace.netlify.app/* https://www.musafespace.org.uk/:splat 301!

NB. The last line is to account for Netlify’s move to .app sometime this month, as per recent emails.

However, none of these redirects are working!

The logs for our most recent master deploy are here.

These confirm that 10 redirect rules are being properly processed i.e. all 5 in both the netlify.toml and _redirects files.

Any leads on this much appreciated! Thanks :smiley:

You don’t specify, but are your redirects on the co.uk site and not on the org.uk site? If they’re on the org.uk site, they won’t work, given the way you seem to have set things up.

It would seem that the easier way to set up your site(s) would be to add the co.uk custom domain to the org.uk Netlify domain, specify the org.uk as the primary domain, and set up your _redirect file as needed from that point.

Hey @gregaven, thanks for your response!

So as far as I understand, all the sites (Netlify subdomain, .co.uk and .org.uk) are being deployed from the same code base, and on Netlify are all one ‘site’.

The .org.uk is the primary one for DNS, and then .co.uk is a ‘domain alias’, as below:

Doesn’t that mean they should both be subject to the same redirects?

Yes, but I’m seeing that you have different DNS specifications for each domain, so they’re not necessarily pointed at the same place.

co.uk uses dns1.p06.nsone.net (etc.)

org.uk uses dns1.p07.nsone.net (etc.)

That seems odd to me. I would think that co.uk should use the same Netlify DNS as org.uk.

Ah good catch! We’ll try this and hopefully it’ll solve it. Will let you know either way.

Do you mind me asking how you identified that that was the case?

Thanks so much for the help! :slight_smile:

In Terminal.app (or the equivalent on your computer):

dig yourdomainname.com -t NS

Repeat as needed.

For more information:

man dig
1 Like

Thanks again for your continued help with this! Always nice to learn a new terminal command :smiley:

I used dig and saw the same thing - however I then logged into our domain name admin panel and checked that the nameservers lined up on there, and they do! Which makes no sense…

I’ll attach pictures to demonstrate what I mean - first for .org.uk:

and then for .co.uk (new users can only post one photo per post):

Do you have any idea what might be going on?

From what I understand, whois is essentially a contact database and while it may mirror some details from DNS, DNS is the authoritative source, not whois.

If the actual entries are correct – as opposed to what whois reports they are – then you might have a propagation issue. Try changing the TTL (Time To Live) on the co.uk site’s DNS records. If that doesn’t work, then contact your registrar and ask them to help get the correct records pushed out to other DNS resolvers.

Hi again @gregraven!

Thanks for your response almost a month ago now. We did what you suggested, first checking that we had entered the nameservers correctly for both domains, and then changing the TTL on the .co.uk record. That didn’t work, so we contacted the registrar, who responded with this:

I’ve done a bit of research into authoritative vs non-authoritative nameservers, but couldn’t figure out how this information from them is supposed to be helpful… I think they are suggesting that it’s a problem on Netlify’s side? I’ll be honest, I’m baffled at this point.

Would be really grateful if you have any ideas about this! :smiley:

We may need to back up a bit here. When you say the same content is being served under two different domain names, does that mean you have one website with two domains pointing at it, or two identical websites, each with its own domain name?

I was assuming the first, which is why it’s confusing to see that you have different settings for the two sites:

dig musafespace.co.uk -t NS

musafespace.co.uk.	3600	IN	NS	dns1.p06.nsone.net.
musafespace.co.uk.	3600	IN	NS	dns2.p06.nsone.net.
musafespace.co.uk.	3600	IN	NS	dns3.p06.nsone.net.
musafespace.co.uk.	3600	IN	NS	dns4.p06.nsone.net.
dig musafespace.org.uk -t NS

musafespace.org.uk.	3600	IN	NS	dns1.p07.nsone.net.
musafespace.org.uk.	3600	IN	NS	dns2.p07.nsone.net.
musafespace.org.uk.	3600	IN	NS	dns3.p07.nsone.net.
musafespace.org.uk.	3600	IN	NS	dns4.p07.nsone.net.
1 Like

I think Greg’s gotten it correct - you’ll need to update your settings at your registrar. I know that both domains SAY they are set to dns1.p07.nsone.net and the other 3 (dns2/3/4), but what Greg has shown is what I see; the .co.uk domain actually uses dns1-4.p06.nsone.net. Your registrar (admin.names.co.uk) should be able to help you get that fixed up; we don’t have any ability to do so from our side.

Note that the .org.uk DOES use the *.p07.nsone.net hostnames so please do NOT change that one, it’s already correct!

1 Like

Yes Greg that is right, it is the former - one GitHub repo being built and deployed by Netlify under one site, with both domains pointing there!

Thank you both for clarifying that it is not a problem with my set up or with Netlify, but with the registrar. We will go back to them again and hopefully get a final resolution. Will drop a note here when that happens, just for the mutual satisfaction.

All the support much appreciated! :smiley:

1 Like

Hi again folks - I’m sorry to say this saga continues!

When we asked names.co.uk to correct this (again), they sent this reply:

Here is the current output from the WHOIS, direct from the registry

Domain name:
musafespace.co.uk

Registrant:
Domain Proxy Service. Namesco Limited.

Registrant type:
Unknown Registrant’s address:
Acton House
Perdiswell Park
Worcester
Worcestershire
WR3 7GD
United Kingdom

Data validation:
The registrar is responsible for having checked these contact details

Registrar:
Namesco Limited [Tag = NAMESCO]
URL: http://www.names.co.uk Relevant dates:
Registered on: 06-Mar-2020
Expiry date: 06-Mar-2021
Last updated: 12-Mar-2020

Registration status:
Registered until expiry date.

Name servers:
dns1.p07.nsone.net
dns2.p07.nsone.net
dns3.p07.nsone.net
dns4.p07.nsone.net

WHOIS lookup made at 10:14:35 14-May-2020

As you can see, the nameservers are set correctly. If Netlify are seeing different, then they are seeing a cached record, and they will need to rectify that on their systems

Please rate our responses so that we may improve our service. Visit https://www.names.co.uk/support-feedback?supportref=3L13011719 to let us know how we’ve done.

Is it possible this is indeed a Netlify-side problem, or have the registrar got it wrong? I’m inclined to think the latter, because they’ve been really unhelpful so far and it doesn’t fill me with confidence. @fool is there any way you can reset your cached DNS records for our site from you end, just to be sure?

At this point I have been trying to think of workarounds, like taking the sites off Netlify DNS and putting appropriate rules directly into the names.co.uk cPanel. But they don’t even offer automatic https support with Lets Encrypt, so this would mean producing and attaching our own SSL certificate multiple times a year - also not a good solution!

Any light you can shed would be much appreciated. I am sorry to keep having to bug you about this. It is quite frustrating :cry:

Cheers and I hope you’re both well!

Something is still weird at names.co.uk, but I don’t think it is causing this problem. There’s details below if you want to pursue it, but I think you can fix just from your redirects config now.

What I’m seeing is that your /* redirect for your single page app is listed BEFORE the domain redirects; you’ll want to reverse the order - domain redirects first. Then I think things will work as you expect :slight_smile:

This is what their service says when asked one way:

$ whois musafespace.co.uk

    Domain name:
        musafespace.co.uk

    Registrant:
        Domain Proxy Service. Namesco Limited.

    Registrant type:
        Unknown

    Registrant's address:
        Acton House
        Perdiswell Park
        Worcester
        Worcestershire
        WR3 7GD
        United Kingdom

    Data validation:
        The registrar is responsible for having checked these contact details

    Registrar:
        Namesco Limited [Tag = NAMESCO]
        URL: http://www.names.co.uk

    Relevant dates:
        Registered on: 06-Mar-2020
        Expiry date:  06-Mar-2021
        Last updated:  12-Mar-2020

    Registration status:
        Registered until expiry date.

    Name servers:
        dns1.p07.nsone.net
        dns2.p07.nsone.net
        dns3.p07.nsone.net
        dns4.p07.nsone.net

and this is what it says when we ask the other way. These should be identical lists…

$ dig -t ns musafespace.co.uk

; <<>> DiG 9.10.6 <<>> -t ns musafespace.co.uk
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 44717
;; flags: qr rd ra; QUERY: 1, ANSWER: 4, AUTHORITY: 0, ADDITIONAL: 5

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 512
;; QUESTION SECTION:
;musafespace.co.uk.		IN	NS

;; ANSWER SECTION:
musafespace.co.uk.	3600	IN	NS	dns3.p06.nsone.net.
musafespace.co.uk.	3600	IN	NS	dns4.p06.nsone.net.
musafespace.co.uk.	3600	IN	NS	dns1.p06.nsone.net.
musafespace.co.uk.	3600	IN	NS	dns2.p06.nsone.net.
1 Like

THIS HAS FIXED IT :grin:

Thank you so much for all your help - resolving this has literally made my day.

Cheers and take care x