Protect Your Site, Build Trust
Discover practical solutions to fix all SSL and security errors quickly and keep your website safe and reliable.
Google reCAPTCHA used. Privacy Policy and Terms of Service apply
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.
Protect Your Site, Build Trust
Discover practical solutions to fix all SSL and security errors quickly and keep your website safe and reliable.
Google reCAPTCHA used. Privacy Policy and Terms of Service apply
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.
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:
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.
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.
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.
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:
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.
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.
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/
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.
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.
If your API requests are failing due to a blocked port, try changing the request URL to a safer port.
You can find a full list of the restricted ports in Google’s official documentation.
Certain browser extensions can cause conflicts. Outdated cache data might also be interfering with requests.
If the problem persists, move on to the next step.
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.
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.
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.
Tackle all SSL errors like an expert! Download our free “How to Fix the Most Common SSL and Security Errors” ebook!