-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Open
Description
Description
When using allowedDomains with a dev server that uses webpack, the domain filter's _checkUrl() function throws TypeError: Failed to construct 'URL': Invalid URL on relative URLs like /__webpack_hmr (webpack's hot module reloading endpoint).
Root Cause
In src/domain-filter.ts (and the corresponding inline script in cli/src/native/network.rs), the WebSocket URL is parsed with:
var parsed = new URL(url);new URL(url) requires an absolute URL. Relative paths (e.g. /__webpack_hmr) need a base URL to resolve against, otherwise the constructor throws a TypeError.
Steps to Reproduce
- Configure
allowedDomainsin agent-browser - Run a webpack dev server (or any setup that opens WebSocket connections with relative URLs like
/__webpack_hmr) - Observe
TypeError: Failed to construct 'URL': Invalid URLin the console
Expected Behavior
Relative URLs should be resolved against the current page origin (location.href) without throwing an error.
Affected Files
src/domain-filter.ts—_checkUrl()functioncli/src/native/network.rs— inline WebSocket filter script
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels