Solving 400 and 500 Error Codes
Error codes suck and can be intimidating especially when you don’t know what is causing them. Oftentimes, the error codes themselves can actually help you navigate the problem and find the solution. Throughout this blog we will be discussing how to use error codes to detect the problem and fix it. We’re going to specifically talk about 400 and 500 error codes. The 400 is a website error whereas a 500 error code is server side.
Common 400 Error Codes
401 Unauthorized: This error code means that you need a username and a password to access. When you get this code you can assume that you can’t access the website, file, or directory without the proper credentials. To solve this problem you can clear your cache and refresh, flush your DNS, or check the www-authenticate header response.
403 Forbidden: The permissions on a certain website, file, or directory that you’re trying to access with your browser aren’t set. To actually access or read those files you will need to change the permissions on those directories. To fix this issue you can clear your cache and refresh, check your permissions, or contact the website administrator.
404 Not Found: These errors are probably the most common. You have typed in a url that doesn’t actually exist. To solve this problem, you need to double check the url and make sure it is correct. Oftentimes, the web address has been taken down or you have mistyped.
When you receive a 400 error message, the first thing you can do is clear your cache and reload the page. Sometimes, simple fixes like this can solve your permission issues. If you receive a 404 code make sure you double check spelling of the url you entered. Finally, you can always check the logs on the server. This is an effective way to get a little bit more information on what happened when those errors came up and find out more specific information.
Common 500 Error Codes
502 Bad Gateway Error: Your browser has recognized a proxy in between your browser and the actual website. This could be a CDN or something that is keeping you from connecting with the website. To fix this issue you can refresh your browser, clear your cache and cookies, or contact the website administrator/hosting provider.
503 Service Unavailable: This means that there are so many requests going into the server that php no longer has any workers available to provide your browser with a place in line. High levels of traffic have taken up all the websites php workers and so many people are waiting so you can’t even get in the queue. In this situation you need to increase the number of php workers for your site so visitors can access it.
504 Gateway Timeout: In this situation there was a php worker that you were assigned a place in line with but you’ve been in the queue for so long and there aren’t enough server resources to process your request. It timed out after a certain period of time. Basically your web server didn’t receive a timely response so it prompted an error. Similar to the 503 error, the website needs an increased number of php workers so they can serve all their site visitors.
On the 500 side you may just want to try back later. If your request timed out it may be maybe that they’ve been so slammed with traffic and perhaps their web host couldn’t handle it. On heavy traffic days like Black Friday and Cyber Monday you may go to your favorite e-commerce website and want to buy something and get a timeout error. If it is your website that’s timing out then you may want to reconfigure the htaccess file, there that’s not allowing the proxy to function correctly. You also may just want to reboot the server, clear out all the processes, and let them build up again. Usually that’s just a patch and what you really need is to add resources and scale up vertically or horizontally to get more resources to process the traffic. If you see a 500 error code on your site contact your web host. Even though they may not have broken something they may be able to help you fix something or provide the best recommendations on how to fix that. Then check your logs to make sure everything is working correctly.