Understand the HTTP 401 Unauthorized error code: What the causes are and how to fix it.
Table of Contents
- What is the 401 Unauthorized Request error?
- 401 Unauthorized vs 403 Forbidden
- How to fix the 401 Unauthorized Request error
- All HTTP Status Codes
What is the 401 Unauthorized Request error?
The 401 HTTP is a client-side standard response status code. This error response indicates that the client request has not been completed because it lacks valid authentication credentials for the requested resource.
For instance, you get this HTTP 401 error code when you are trying to access a password protected page. You can also get this 401 error if your credentials expired.
Different 401 error messages depending on the server
- “401 Unauthorized”
- “401 Authorization Required”
- “Access Denied”
- “HTTP 401 Error – Unauthorized”
- “This page isn’t working – If the problem continues, contact the site owner. – HTTP ERROR 401”
For example, in Chrome browser, you’ll likely see a simple message telling you that “This page isn’t working”, like this one:
Sometimes, the server replies with a standardized error page, e.g. the Nginx 401 Authorization Required:
You can also find personalized 401 Error pages. The following is an example of our wetopi customized 401 Unauthorized error response, when accessing a site with “Restrict access” enabled.
401 Unauthorized vs 403 Forbidden
The 401 error is similar to the “HTTP Error 403 Forbidden“. We get the 403 when we have valid credentials (or don’t need them) but access to the resource isn’t permitted (in other words, you are trying to access a private or restricted resource the server will never give you, no matter what).
On the other hand, we get the 401 status code when the resource is available, but we don’t provide, or don’t have, valid credentials.
How to fix the 401 Unauthorized Request error
To identify, and fix the error causing your 401 Unauthorized HTTP error code, we give you a list of causes and their solution. Follow the tips on the list until you find the solution:
- Look for errors in the URL. An incorrectly-typed URL or an outdated link could be the cause.
- If your request is private, a password-protected page. Then double-check whether you’re logged in with a valid username and password. If you’re sure that you have entered the credentials correctly, try Logging out and Logging in again. If the error persists, try changing the password.
- Open the URL in an Incognito Browser Window. If you get access in Incognito, it means that the reason you get a 401 error is that your browser’s cache and cookies are out of date.
- A configuration problem on the website. If you are a webmaster and you are running a WordPress site: try to disable the plugins one by one. Pay special attention to the plugins related to security management and resource protection.
- Some web providers issue the HTTP 401 when a domain is pointing to the wrong server. If you are a webmaster, double-check the DNS Records (also named DNS Zones). The IP addresses of your site’s DNS Records could be pointing to the wrong server.
- Your computer’s DNS cache contains invalid zones. An outdated, or corrupted DNS cache in your computer is not a common cause of the “401 Unauthorized HTTP Error”. Nonetheless, it is worth considering flushing your device’s DNS cache.
We are techies passionate about WordPress. With wetopi, a Managed WordPress Hosting, we want to minimize the friction that every professional faces when working and hosting WordPress projects.
Not a wetopi user?
Free full performance servers for your development and test.
No credit card required.
All HTTP Status Codes
203 Non-Authoritative Information
204 No Content
205 Reset Content
206 Partial Content
208 Already Reported
226 IM Used
300 Multiple Choices
301 Moved Permanently
303 See Other
304 Not Modified
305 Use Proxy
307 Temporary Redirect
308 Permanent Redirect
402 Payment Required
404 Not Found
406 Not Acceptable
407 Proxy Authentication Required
408 Request Timeout
411 Length Required
412 Precondition Failed
413 Payload Too Large
414 Request-URI Too Long
415 Unsupported Media Type
416 Requested Range Not Satisfiable
417 Expectation Failed
418 I’m A Teapot
421 Misdirected Request
422 Unprocessable Entity
424 Failed Dependency
426 Upgrade Required
428 Precondition Required
429 Too Many Requests
431 Request Header Fields Too Large
444 Connection Closed Without Response
451 Unavailable For Legal Reasons