Posted

1 minute read

Reasons for 500 Internal Server Errors when doing GET or POST requests

 

How did we find out about these strange 500 Internal Server errors?

A few of our customers were getting sometimes strange 500 Internal Server errors when running load tests against their application even though when they were trying to make the GET or POST request from the browser it was working without a problem.

We decided to give them a hand finding why this might happen. The answer to the puzzle is quite simple but unless you know about the problem it might take a few hours to get to the bottom of the it.

The problem is that many web applications by default do not take into consideration the fact that some of the following headers might not be present in the client requests:


Accept:application/json;charset=utf-8,*/*
Accept-Encoding:gzip, deflate, sdch, br
Accept-Language:en-US,en;q=0.8,ro;q=0.6
Cache-Control:no-cache
Connection:keep-alive
Host:your_host:8080
Pragma:no-cache
Referer:https://your_host:8080/ui/index
User-Agent:Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.106 Safari/537.36

Why a lot of web applications do not consider the need to check that these headers are really sent in the user request ?

The answer is very simple, because all the browsers by default add these headers to all the requests.

 

What did we decide to implement in the LoadFocus platform to help our customers ?

For helping our customers we decided to add the possibility for the user to get all those headers added to their requests by only clicking one button.

Also we decided to add a few hints that will be displayed on the result page in case the requests return 500 Internal Server error.


Thanks for reading. I hope you learned something interesting about React!
If you found this article useful, please share it with others. Don’t forget to subscribe to get notified for the upcoming articles.