cypress: Cypress will fail wit urls with a domain in the form of "*.local*"
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
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Comments: 16 (6 by maintainers)
Commits related to this issue
- closes #451 - allow .localhost tldr to be parsed correctly — committed to peterhry/cypress by peterhry 6 years ago
- closes #451 - allow .localhost tld to be parsed correctly — committed to peterhry/cypress by peterhry 6 years ago
- Allow .localhost tld to be parsed correctly (#1216) * closes #451 - allow .localhost tld to be parsed correctly * server: add unit + e2e tests for localhost, simplify regexp — committed to cypress-io/cypress by peterhry 6 years ago
By default any domain with the pattern
*.localhostpoints to127.0.0.1. This is becauselocalhostis a loopback address, and DNS implementations have defined this behavior by default.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).
As a workaround I had to add manually
127.0.0.1 project.localhostto my/etc/hostsfile. This fixes the issue, but misses completely the purpose of using a.localhostdomain, 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 😃
Released in
1.4.2.@pmatisko Could you open a new issue detailing the exact problem you are encountering as well as the test code?