Cypress gets 404 on Render subdomains

I have a peculiar issue, where my tests are failing only on Render subdomains.

I’ve created a Github action, which triggers Cypress to run end-to-end tests on our app. For some reason, this results in a 404, even though the app is perfectly alive and accessible during normal browsing.

I’ve narrowed it down to affect only subdomains hosted on Render, e.g. app.mydomain.com and differentapp.mydomain.com.

The tests run fine if:

  • I set the URL to be the top domain (i.e. mydomain.com) or a subdomain not hosted on Render (e.g. app.differentdomain.com).
  • I access the underlying URL, e.g. app-mydomain.onrender.com.
  • I run the same tests locally

As far as I can see, the DNS is set up correctly, with a CNAME record pointing to the subdomain, as outlined in the documentation.

Considering it’s actually a 404, and not a timeout, it seems the app is actually hitting a gateway (or something) which then immediately returns 404.

Where do I go from here?

Hi @nixstrom, if you are using subdomains, you’ll need to configure a wildcard custom domain: Custom Domains | Render · Cloud Hosting for Developers. This will require you to add 2 CNAME records to your DNS settings - one for the wildcard and a second _acme-challenge one.

Thanks, @Jade_Paoletta. Unfortunately, the problem persists, even after adding a CNAME record for * and _acme-challenge. I’ve communicated with the DNS provider, and as far as they can see, my mappings are correctly set up.

Please note:

  • In the Render site settings, the custom domain shows as “Verified” on all our apps.
  • If I access the URLs manually (in a browser or with cURL) it works perfectly.
  • The problem only occurs in certain workflows, for example in our integration tests or when the app is trying to communicate with the api. In this case, the process will fail with a 404.

I’m sure we’re doing something wrong, but my colleagues and I can’t figure out where the mistake is. Does this look correct to you?

  • A records (* and @) pointing to 216.24.57.1
  • CNAME record www pointing to the “root” Render subdomain (e.g. https://our-website.onrender.com)
  • CNAME record for every other subdomain pointing to the corresponding Render apps (e.g. api points to https://our-api.onrender.com)

The above steps is how I understand it should be from the documentation.

Continued (by following this documentation):

  • Wildcard CNAME record * pointing to the app we host on the root domain (e.g. https://our-website.onrender.com)
  • CNAME record for _acme-challenge.mydomain.com pointing to the same.

These two I’m a little uncertain about. I assume they should only be configured once, but I have also tried to set it up for each subdomain. That didn’t work.

I hope you’re able to help — we have exhausted our own knowledge and support lines.

Hi @nixstrom, thanks for the additional information.

It is strange that you are able to access the application ok via the browser or cURL and that it only happens in the scenarios you outlined. I’m wondering if you can check to see if there’s anything unique about the way that Cypress is making those requests - maybe something in the request URL or headers that is being specified differently?

Thanks for taking the time, Jade.

No, as far as I can see, there is nothing special about the request. To make it more bizarre, it only occurs in CI, and only on subdomains.

The issue is not exclusive to Cypress. We also have an issue where our app cannot communicate with the API for authentication (two separate Render services). The request will fail immediately with a 404, unless we target the my-api.onrender.com URL.

Hi @nixstrom thanks for that, I see. It may be helpful to dig a bit further into some specific examples. Would you be able to provide the specific service you’re seeing this on, and maybe capture one or two example requests that are resulting in 404 from cypress or your API? Feel free to DM or email support@render.com to provide the details.