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.

Endless loop when hostname is "dev"

See original GitHub issue

Current behavior

When baseUrl is set to http://dev:3000, cypress run hangs. Enabling DEBUG env var shows Cypress stuck in a loop, due to incorrect parsing of hostname from URL.

In this case, dev is incorrectly parsed as the tld, instead of the domain, since there is now “.” separator.

(See Debug Logs below)

Desired behavior

When baseUrl is set to http://dev:3000, dev would be detected as the domain, not a tld and cypress run would continue to completion.

Test code to reproduce

CYPRESS_baseUrl=http://dev:3000 cypress run

Cypress Version

11.0.1

Node version

v16.16.0

Operating System

Debian GNU/Linux 11 (bullseye)

Debug Logs

I can't include them all because it loops without end, but here was the important line:


cypress:network:cors Parsed URL { port: '3000', protocol: 'http:', subdomain: null, domain: '', tld: 'dev' } +2ms


### Other

I'm using the `cypress/included:11.0.1` Docker image

Issue Analytics

  • State:open
  • Created 10 months ago
  • Reactions:1
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
BlueWindscommented, Dec 6, 2022

We have had a variety of issues with docker domain names / host entries that don’t have a “.” in them - Firefox also has issues parsing them out. I’m having trouble searching for the other ones, but we’ve had similar problems in the past.

The workaround is usually not too bad, as @originalhat pointed out - use a “.” somewhere in the baseUrl. Switching to an IP works; “dev.dev” probably would as well.

If someone wants to dig into this particular case more and make a PR, we’d definitely look at it.

1reaction
defeatedcommented, Nov 29, 2022

@mjhenkes the problem is the host name is being parsed by the Public Suffix domain validator, but it has no “.” notation so it should never make it to domain validation (it’s just a local host name)

this regression was introduced sometime around 10.10+ (10.9 worked fine)

Read more comments on GitHub >

github_iconTop Results From Across the Web

Endless loop when hostname is "dev" · cypress-io ... - GitHub
Fast, easy and reliable testing for anything that runs in a browser. - Endless loop when hostname is "dev" · cypress-io/cypress@da7aa5d.
Read more >
Redirect loop when forcing www. hostname and SSL
I'm going crazy – I just checked and rechecked my rules but I still don't understand why the server is producing a redirect...
Read more >
SFTP Poller endless loop on long filename | DataPower
Hi,I'm seeing some strange behaviour at my customer with the SFTP Poller. We are running a MPGW with an SFTP Poller that polls...
Read more >
ERR_TOO_MANY_REDIRECTS · Cloudflare SSL/TLS docs
This error occurs when visitors get stuck in a redirect loop.
Read more >
How to Fix The ERR_TOO_MANY_REDIRECTS Error - Kinsta
The ERR_TOO_MANY_REDIRECTS error is pretty much what it sounds like: something is causing too many redirects, sending your website into an infinite redirection ......
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