Issue with domains in 'baseUrl' having several dots
See original GitHub issueCurrent behavior:
I’m trying to tests a website on an Azure domain which looks like:
http://my-test-app.westeurope.cloudapp.azure.com
When I try to run cypress, I’m getting the following error:
Uncaught DOMException: Failed to set the 'domain' property on 'Document': 'azure.com' is not a suffix of 'localhost'.
If I try to run cypress run
, my terminal just hangs after (Tests Starting)
without stopping or showing any error.
Desired behavior:
The site is testable.
Steps to reproduce:
See above.
Versions
2.1.0
Also, it seems to be a recent regression, I was able to test this website a few months ago.
Issue Analytics
- State:
- Created 5 years ago
- Comments:8 (4 by maintainers)
Top Results From Across the Web
asp dot net web config key Base URL issue - Stack Overflow
I got an issue during test my asp dot net web based application. In the Page there is an "Slip button" and when...
Read more >Is using dots in URL path really a problem? | SEO Forum - Moz
we have a couple of pages displaying a dot in the URL path like domain.com/mr.smith/widget-mr.smith It displays fine in chrome, firefox and IE...
Read more >The Document Base URL element - HTML - MDN Web Docs
The HTML element specifies the base URL to use for all relative URLs in a document. There can be only one element in...
Read more >FAQ - Using Relative Links - Zoom Search Engine
In Spider Mode, you should not change the Base URL to a relative path. This is because the Base URL is required to...
Read more >GitLab Pages domain names, URLs, and base URLs
The baseurl option might be named differently in some static site generators. Every Static Site Generator (SSG) default configuration expects to find your ......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Hi @jennifer-shehane ,
This still doesn’t work in Cypress 4.0.1. I checked it in 3.8.3 and 4.0.1, and base url is completely ignored if you have more than one dot anywhere in the url.
For example, we have urls like this: _https://sub.domain.com/MyApp-v1.2.3/appArea/_ (notice the multiple dots in the app name)
If I call
cy.visit("https://sub.domain.com/MyApp-v1.2.3/appArea/")
everything is fine, but if I use the recommended approach with baseUrl set in cypress.json like thiscy.visit("MyApp-v1.2.3/appArea/")
, the cypress will ignore the base URL and will navigate to: “http://MyApp-v1.2.3/appArea/”The original question had dots in the baseUrl, and we have the dots in the app name, so this could affect a lot of apps potentially.
Quick fix for this is to URL encode the dots, which means that regular expression that concatenates the baseUrl with app name has a bug. The problem with URL encode is that the asserts and logs in cypress contain the URL encoded text then, so it looks ugly.
I think this should still be treated as a bug.
Thanks!
Running in to this issue in v10.7 and 10.11 as well.
From what I can tell it requires both:
port
in the configurationbaseUrl
inside ofsetupNodeEvents
Example configuration file:
Full minimal reproduction in this repo here: https://github.com/HallOfSame/CypressBaseUrlBug
The error is thrown from the
configure
method inpackages/driver/src/cypress.ts
.When
baseUrl
is set inside ofsetupNodeEvents
the existingdocument.domain
here islocalhost
. Moving thebaseUrl
definition out of the setup method causesdocument.domain
to belocalhost.someDomain.com
instead, fixing the error.