Testing localhost with mabl Link
Browser restrictions on localhost proxying
The mabl Link feature was designed to enable testing against any URL that could be accessed from the host on which the Link Agent is running. Fundamentally, mabl Link works by proxying traffic from the browser running in the mabl cloud through the Link Agent to your test environment. Unfortunately, most browsers restrict the URLs that may be used with this type of proxy configuration for security reasons.
New restrictions in Chrome and Firefox
You may have noticed that mabl Link tests that used to work against
localhostURLs in Chrome and Firefox no longer work. The reason for this is that Chrome and Firefox added restrictions that prevent connections to all link-local addresses (e.g.
127.0.0.1) from being proxied via mabl Link.
The same restrictions that Chrome and Firefox recently added were already present in both Internet Explorer and Safari.
Currently there are no mabl-supported browsers that allow
localhost URLs to be proxied via mabl Link without applying the hosts file workaround described below.
Testing against localhost when the Link Agent is running in Docker
See the separate documentation on
localhosttesting in Docker here: Link with Docker
Suggested work-around for testing services running on localhost
Fortunately there is a work-around that will allow you to run tests against services that are listening on
localhost. The required change is to add an alias for
localhost in the
hosts file of the system where the Link Agent is running (which should also be the host where the service you want to test is running). The alias should point to the same IP as
localhost, but it should have a unique name, such as
On Linux and MacOS the file to edit is
/etc/hosts. You should add your alias to the same line as
localhost, for example:
127.0.0.1 localhost link-host
On Windows systems the file is located in
C:\Windows\System32\Drivers\etc\hosts, and the change is the same.
Once the alias has been added, you can then update your tests to use this new hostname. For example, if your test had previously been pointing at
http://localhost:8080, and your new alias is called
link-host, update your test to point to
Updated 4 months ago