I have been using Alibaba Cloud SLB load balancer for more than 5 years, and I have been using it since the initial Alibaba Cloud internal beta, and after deployment, the following error occurred:
Errors occur intermittently, after initially booting, there is no 502 gateway error, after waiting for a minute, the error appears, the backend Windows Server IIS container ASP.NET website.
Click IIS from the server to open the browser, you can browse normally, SLB load balancing indirect problems, this is the first time I have encountered it.
Solution:
The problem mainly appears in the "Health Check Method" settings, the default settings are as follows:
The backend health check is requested in the head way, and if the corresponding status code returns 2xx or 3xx, the backend server is considered normal.
We tried to make a header request in three ways, first, I directly ran the local project and tested it locally.
Test 1:
Use the postman test as shown below:
Returning to the 404 Not Found state, in fact, here, we know what caused it.
Test 2:
Use curl testing as shown below:
C:\Users\itsvse>curl -i -X HEAD http://localhost:60155/
Warning: Setting custom HTTP method to HEAD with -X/--request may not work the
Warning: way you want. Consider using -I/--head instead. HTTP/1.1 404 Not Found
Cache-Control: private
Content-Length: 4432
Content-Type: text/html; charset=utf-8
Server: Microsoft-IIS/10.0
X-SourceFiles: =?UTF-8?B?QzpccHJvamVjdFxteVxDb2RlU2hhcmluZ1xDb2RlU2hhcmluZy5XZWJVSVxIb21lXEVycm9yNDA0?=
X-Powered-By: ASP.NET
Date: Tue, 13 Aug 2019 03:53:04 GMT
curl: (56) Recv failure: Connection was reset
Also returned is a 404 status code.
Test 3:
This time, we tested directly on the official server, through the curl test under PowerShell, as shown in the figure below:
You can see that the same page is requested through the head,Sometimes return404status code, sometimes returned200Status code, thus confirming the intermittent 502 errors we encountered at the beginning.
What causes asp.net intermittently returning 404 and 200 status codes?
Since our homepage has a cache, when the user uses the get method to request the homepage, the page will be cached successfully, and then the head and get will always return the cached page, and will also return the 200 response code, if, after the cache expires, no user makes a get method request, only the head method request through the command, a 404 error will occur. It is estimated that few people will encounter this kind of problem.
The solution is to check all response status codes in the health check mode, as shown in the figure below:
How to troubleshoot Layer 7 Listening (HTTP/HTTPS) health check abnormalities:The hyperlink login is visible.
(End)
|