question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Cypress will fail wit urls with a domain in the form of "*.local*"

See original GitHub issue

If you try to run Cypress having set up the baseUrl as something like something.localhost or something.localsite it will not run and instead it will bring up a browser screen with a grey background, no command log window

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:16 (6 by maintainers)

github_iconTop GitHub Comments

4reactions
brian-manncommented, Feb 5, 2018

Released in 1.4.2.

3reactions
jawiracommented, Nov 22, 2021

By default any domain with the pattern *.localhost points to 127.0.0.1. This is because localhost is a loopback address, and DNS implementations have defined this behavior by default.

As a top-level domain, the name has traditionally been defined statically in host DNS implementations with address records (A and AAAA) pointing to the same loopback addresses. Any other use conflicts with widely deployed algorithms relying on this convention. – https://en.wikipedia.org/wiki/.localhost

In my experience, this behavior is respected in Firefox and Chrome, and also in Windows and Ubuntu.

Sadly when running tests with Cypress this behavior is not respected. I don’t have the gray screen as other users in this issue, but my tests fail because host cannot be reached (everything works well when using the browser without Cypress).

ksnip_20211122-145943

As a workaround I had to add manually 127.0.0.1 project.localhost to my /etc/hosts file. This fixes the issue, but misses completely the purpose of using a .localhost domain, it’s very annoying to add all your domains one by one when you have many services (typically when using a reverse proxy like Traefik).

It would be great if you can fix this, thanks in advance 😃

Read more comments on GitHub >

github_iconTop Results From Across the Web

Web Security - Cypress Documentation
Injects document.domain into text/html pages. Proxies all HTTP / HTTPS traffic. Changes the hosted URL to match that of the application under test....
Read more >
visit - Cypress Documentation
Cypress will prefix the URL with the baseUrl configured in your global configuration if set. ... You cannot visit different super domains in...
Read more >
Best Practices - Cypress Documentation
This way, if it is changed, the test will fail. If the answer is no because the text could be changed - then...
Read more >
Error Messages | Cypress Documentation
This error only pertains to Cypress version v11.0.0 and under. As of Cypress v12.0.0, users can navigate to multiple domains in a single...
Read more >
Cypress 9.6.0: Easily test multi-domain workflows with cy.origin
Today we're proud to introduce a feature a lot of Cypress users have been asking for: testing multiple superdomains in a single test!...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found