ERR_UNSAFE_PORT - 6 Ways to Fix It
Table of Contents
Both as a website owner, or a regular user, you may come across the ERR_UNSAFE_PORT error. This happens when a URL attempts to use a port that modern browsers have restricted for security reasons.
While blocking these ports helps protect against potential threats, it can sometimes interfere with legitimate requests, and cause unexpected issues.
Fortunately, there are several ways to resolve this error. In this guide, we’ll explain why ERR_UNSAFE_PORT occurs and walk you through the most effective solutions to fix it.
For example, try accessing any website through a known restricted port, such as 6666. You would see the following error message:

When a website or resource attempts to use a blocked port, the browser immediately stops the connection and displays this error code. This issue is most commonly seen in Google Chrome, but other browsers have similar restrictions.
What Causes the ERR_UNSAFE_PORT Error?
Browsers block specific ports to prevent security threats, such as unauthorized attempts to access data, or malicious attacks.
The ERR_UNSAFE_PORT error occurs when a website or resource tries to use one of these restricted ports. Here are the most common causes:
External Resources Using a Blocked Port
If your website loads scripts, images, or other resources from an external URL that uses a blocked port, the browser will block the request. This can happen if a third-party service or API is configured to use an unsafe port.
Incorrect Redirects or Proxies
If your site redirects traffic to a URL with a blocked port, the browser will flag it as unsafe. This often happens when misconfigured proxy settings or server-side redirects point to restricted ports.
API Requests to a Blocked Port
Some APIs require specific ports for communication. If an API request is made to a blocked port, the browser will refuse the connection, leading to the error. Developers may encounter this issue when testing APIs on non-standard ports.
How to Fix the ERR_UNSAFE_PORT Error?
Depending on the cause, you can resolve the ERR_UNSAFE_PORT error by adjusting your website, server, or browser settings. Here are the most effective solutions:
Check for External Resources Using Blocked Ports
Review your website’s code to identify any external resources using restricted ports. These could be scripts, images, or stylesheets from third-party services.
To do this, open the browser’s developer tools (right-click > Inspect), go to the Network tab and reload the page.

Look for requests that fail due to blocked ports and update them to use allowed ports.
Remove Redirects to Blocked Ports
If your website redirects visitors to a URL using a restricted port, browsers will block the request and display the ERR_UNSAFE_PORT error.
This can happen due to incorrect .htaccess rules, misconfigured WordPress settings, or third-party services like Cloudflare.
- Check and Update Your Website Redirects
If you’ve added redirect rules in your .htaccess file, they may be pointing to a blocked port.
SiteGround users can check and edit this file via Site Tools > Site > File Manager or with an FTP client.
Here’s an example of a redirect that would cause such issues:
Redirect 301 / https://yourdomain.com:6666/
To fix it, simply change it to a default safe port, such as 443 (HTTPS). Since browsers automatically assume 443 as a default HTTPS port, the new address should be:
Redirect 301 / https://yourdomain.com/
- Check WordPress URLs and Plugin Redirects
If you use a redirect plugin, it may be altering your site address or adding incorrect rules.
First go to your WordPress Dashboard > Settings > General, and check the WordPress Address (URL) and Site Address (URL).

Make sure they do not include a blocked port like https://yourdomain.com:8080.
Also check if a redirect plugin is active (e.g., Redirection or Yoast SEO). Review its settings for any custom rules forcing a blocked port.
- Review CDN or Other Proxy Services
If your site is behind a CDN (like Cloudflare) or uses a proxy service, look for any redirects forcing traffic to a blocked port and update them.
Use an Alternative API URL
If your API requests are failing due to a blocked port, try changing the request URL to a safer port.
- Check the API documentation for other ports that are safe and supported.
- Update the request URL to use a different port, such as 443 for HTTPS.
- If using a local server, reconfigure it to run on a safe port.
You can find a full list of the restricted ports in Google’s official documentation.
Check Browser Extensions & Cache
Certain browser extensions can cause conflicts. Outdated cache data might also be interfering with requests.
- Try loading the site in Incognito Mode to rule out extension issues.
- Disable all extensions and test the site again.
- Clear your browser cache and cookies.
- Update your browser to the latest version.
- Reset Google Chrome to default settings.
If the problem persists, move on to the next step.
Modify Browser Flags (Unsafe)
Some browsers allow overriding port restrictions through experimental flags.
On Windows, you can do this by right-clicking your Chrome shortcut > Properties > go to the Shortcut tab:

In the shortcut Target field, add the flag –explicitly-allowed-ports=’port number’ at the end of the address.
It should look something like this:
Click Apply and re-open Google Chrome again using the shortcut.
Alternatively, you can run the following command in Command Prompt, to open Chrome with certain unsafe ports allowed:
chrome.exe --explicitly-allowed-ports=666,6000,8080
For macOS, open your Terminal and run:
open -a "Google Chrome" --args --explicitly-allowed-ports=666,6000,8080
Keep in mind this workaround is not a fix for the root cause of the error and should only be used for local testing, not on live websites.
Contact Hosting or Network Administrator
If you’re unable to fix the issue, your hosting provider or network admin might be blocking the port.
If the issue persists after going through the recommended steps above, look for other answers by contacting your hosting support team. They can check and advise if they restrict certain ports.
If on a company network, ask the IT team to review firewall rules and also help you reset settings on your device.
ERR_UNSAFE_PORT – Recap
The ERR_UNSAFE_PORT error is a browser security measure that prevents connections to restricted ports. While this helps protect users from potential threats, it can also block legitimate requests.
If you encounter this error, start by identifying any external resources, redirects, or API requests using blocked ports.
Updating URLs, modifying server configurations, and clearing browser data can often resolve the issue. For more advanced cases, you may need to contact your hosting provider or network administrator.
By following the steps in this guide, you should be able to fix the ERR_UNSAFE_PORT error and maintain website access without compromising security.