Guide

Spotify Error Code 4 and "A Firewall May Be Blocking Spotify": The Proxy Settings Fix

Spotify shows error code 4 when the desktop app cannot reach its servers and blames the firewall or the proxy settings. Which proxy mode to pick, and what else breaks it.

HProxy Team··5 min read
HProxy.Guide

Skip the dead lists.

Our free proxy list re-checks every exit every few minutes across 100+ countries, with a live last-checked time, so you copy IPs that worked moments ago, not a stale text dump.

Open the free proxy list

The message is one of the few consumer errors that mentions proxies by name: "A firewall may be blocking Spotify. Please update your firewall to allow Spotify. Additionally you could try to change the currently used proxy settings. (Error code: 4)". It appears at sign-in or when the desktop app opens, on a computer whose internet is otherwise working, and it sends people into two settings screens at once, the firewall's and the proxy's. Both are the right places to look, and the order matters less than knowing what each one does.

Spotify's desktop app makes its own connections to Spotify's servers, and it has its own proxy setting, separate from the browser's and from the operating system's. By default that setting is Auto-detect, which tells the app to follow whatever proxy the computer is configured with. That default is why a proxy the user never knowingly set up, a leftover from a VPN or a security suite, or the proxy of an office network, breaks Spotify while everything in the browser still loads: the browser may be handling it differently, and Spotify simply fails. Code 4 is the app reporting that it could not get through, with two guesses attached.

Fix 1: set Spotify to No proxy

Open the desktop app, click your name or the menu, choose Settings, and scroll to Proxy settings. The Proxy type dropdown offers Auto-detect settings, No proxy, HTTP, SOCKS4, and SOCKS5, with fields for host, port, username, and password. Set it to No proxy and restart the app.

For most people this is the whole fix, because it stops Spotify from following a system proxy that does not work. If the app opens after the restart, a proxy configured on the computer was the cause, and it is worth finding: open Settings, Network & internet, Proxy on Windows (or System Settings, Network, your connection, Details, Proxies on a Mac), read the address, and switch it off if it is not one you or your organisation put there. How to turn off a proxy explains what a 127.0.0.1 address means versus an unfamiliar public one, and when a leftover is worth a scan.

If Spotify's proxy type was already set to HTTP or SOCKS with an address you do not recognise, the same applies: a program set it, and clearing it is the fix.

Fix 2: allow Spotify through the firewall

The first half of the message. Windows Defender Firewall normally allows Spotify when it is installed, but a third-party firewall or an antivirus suite with a "web shield" or "application control" feature frequently does not, especially after a Spotify update changes the executable.

On Windows, open Windows Security, Firewall & network protection, Allow an app through firewall, click Change settings, and confirm Spotify is listed and ticked for private and public networks; if it is missing, Allow another app and browse to it. Then open the third-party product's application or firewall list and allow Spotify there too. The fastest diagnostic is to disable the third-party product for a minute and open Spotify: if it signs in, add the exception and turn the product back on. On a Mac, System Settings, Network, Firewall, Options lists blocked apps.

Fix 3: turn off the VPN

A VPN reroutes everything, and some VPN exits are blocked by Spotify's servers, or the VPN's own configuration interferes with the app's connections. Disconnect the VPN and open Spotify. If it works, the VPN is the cause; reconnect to a different server, or leave Spotify outside the VPN using the VPN's split-tunnelling feature where it has one. A VPN that is half-connected or that has crashed also produces code 4, and reconnecting or restarting the client fixes that.

Fix 4: check DNS

If Spotify cannot resolve its server names, it cannot connect, and the error looks identical. Set the connection's DNS to a public resolver such as 1.1.1.1 or 8.8.8.8 and restart the app. On Windows, ipconfig /flushdns in a terminal clears a stale cache first.

Fix 5: the network itself

Offices, schools, dormitories, and some hotels either require a proxy that Spotify's Auto-detect follows and cannot log in to, or block streaming outright. Setting No proxy handles the first. For the second, the same computer will work at home and on mobile data, which is the test, and only the network's administrator can change it.

Fix 6: the app's own state

Rarely, the app's cached data is corrupt. Sign out, quit fully (including from the system tray), and sign in again. If that fails, uninstall, delete the leftover Spotify folder in the application data directory, and reinstall. Reinstalling does nothing for the firewall, the proxy, the VPN, or DNS, which is why it belongs at the end of the list rather than the start.

Using a proxy with Spotify on purpose

Spotify's proxy settings exist for a reason, and some readers arrive here because a proxy they configured deliberately has stopped working. The app accepts HTTP, SOCKS4, and SOCKS5 proxies with a username and password, and it needs a restart after any change. Code 4 with a deliberate proxy means the proxy is dead, slow, refusing the app's connections, or asking for credentials it is not receiving. Test the address in our proxy checker first: a dead or slow result explains everything, and public proxies produce that result constantly, which our post on free proxies for Spotify covers in detail. A proxy that has to carry a streaming session needs to stay up and keep one address for hours; a fixed ISP proxy or a residential line with a sticky session is the kind that does, and the Spotify proxy guide covers the setup. Spotify's terms and its regional rules apply to the account regardless of the address it connects from.

The order that works

Set Spotify's proxy type to No proxy and restart. Allow the app through Windows Firewall and any third-party security product. Turn the VPN off. Switch DNS to a public resolver. If it works everywhere except one network, that network is blocking it. And if the proxy was deliberate, test it before you blame the app.

Frequently asked questions

What does Spotify error code 4 mean?
The desktop app could not reach Spotify's servers to sign in or load, and it is guessing at why: the message says a firewall may be blocking Spotify and suggests changing the proxy settings. The guess is right often enough. A firewall or security suite blocking the app, a proxy configured on the computer or inside Spotify that no longer works, a VPN, or a DNS problem all produce code 4. The internet connection itself is usually fine.
Which proxy setting should Spotify use?
For almost everyone, No proxy. Open Settings in the desktop app, scroll to Proxy settings, set Proxy type to No proxy, and restart the app. The default, Auto-detect settings, makes Spotify follow the computer's proxy configuration, so a leftover system proxy breaks Spotify while No proxy ignores it. Choose HTTP or SOCKS5 only if you are deliberately routing Spotify through a proxy you control.
How do I allow Spotify through the Windows firewall?
Open Windows Security, Firewall & network protection, Allow an app through firewall, click Change settings, and make sure Spotify is listed and ticked for both private and public networks; add it with Allow another app if it is missing. Then check any third-party antivirus or firewall, which has its own application list and is the more common blocker. A quick test is to disable the third-party product for a minute and open Spotify.
Why does Spotify say error code 4 only on one network?
That network requires a proxy or blocks Spotify's traffic. Offices, schools, and some public networks route web traffic through a proxy that Spotify's Auto-detect setting picks up and cannot authenticate with, or they block streaming outright. Set Spotify to No proxy to stop it following the network's proxy, and if it still fails there, the network is blocking it and only its administrator can change that.
Can I use a proxy with Spotify on purpose?
Yes. Spotify's proxy settings accept HTTP, SOCKS4, and SOCKS5 with a host, port, username, and password, and the app routes its traffic through them after a restart. It needs a proxy that stays up and keeps one address for the session, which rules out free public proxies, and Spotify's terms and regional rules still apply to the account. A fixed residential or ISP address is the kind that works.
Does reinstalling Spotify fix error code 4?
Only when the app's own data is corrupt, which is rare. Reinstalling does not change the firewall, the system proxy, the VPN, or DNS, which are the usual causes, so the error returns after a reinstall unless one of those was fixed along the way. Work through the proxy and firewall steps first; reinstall last.

Get proxies that are alive right now

Our free list re-checks every exit every few minutes and shows a last-checked time, so you copy IPs that worked moments ago, not a stale text dump. When the location has to survive a real check, the paid network holds up.

129M+ proxy checks run · 100+ countries · HTTP / HTTPS / SOCKS · re-checked every few minutes · no signup