How to make the user's request temporarily responsive when the origin site encounters a problem. When a problem occurs on the origin site, how does one make the user's request temporarily available to respond to a problem on the origin site, and cannot return the requested content to the user, is there any way to make the user still get the content? how can I make the user's request temporarily receive a response when the origin site encounters a problem?
When the origin site fails to return the requested content to the user, how can the user still get the content, even if it is an expired content?
Method 1: Add the ats plug-in to implement:
To prevent problems on the origin site, if the data fails to be returned due to timeout, the ats proxy server will directly return error codes such as 502 and 504 to the user, the impact is used for experience. the ats plug-in function can be added to realize that when ats receives 502 and 504 returned by the origin site, if ats has expired cached data locally, then, the expired cache data is temporarily returned to the user. in the user's view, it is 200 successful access.
Method 2: Use the processing mechanism provided by ats:
If the origin site cannot return data to ats, for example, if the origin site service is stopped and the machine is down, TCP_REFRESH_FAIL_HIT/200 is returned if ats has a cache, after that, access is always TCP_HIT/200 until proxy. config. http. cache. max_stale_age indicates that the cache value has arrived, and TCP_REFRESH_FAIL_HIT/502 will be returned for another request.
Configuration Items in records. config:
Proxy. config. http. cache. max_stale_age INT 604800
Description of the preceding configuration item: maximum response time of the old object (604800 s by default) before the object cannot be cached ).
The premise for the above two methods to achieve the expected results is: ats has a cache and has expired
============
Test in the case of Method 2 above:
The differences between some response header information of the client are as follows:
1. the server provides services normally and responds normally (TCP_HIT/200 ):
Proxy-Connection: keep-alive
* Connection #0 to host 192.168.10.74 left intact
* Closing connection #0
2. send the same request again under server stop (TCP_REFRESH_FAIL_HIT/200 ):
* HTTP/1.1 proxy connection set close!
<Proxy-Connection: close
<Warning: 111 DLC-3.0
* Closing connection #0
3. send multiple identical requests (TCP_HIT/200) based on the above 2 ):
Proxy-Connection: keep-alive
<Warning: 111 DLC-3.0
* Connection #0 to host 192.168.10.74 left intact
* Closing connection #0
4. when the configuration value of 604800s is reached under server stop, send the request again (TCP_REFRESH_FAIL_HIT/502 ):
Proxy-Connection: Keep-Alive
>
<HTTP/1.1 502 Connection refused
* Connection #0 to host 192.168.10.74 left intact
* Closing connection #0
When the origin site fails to return the requested content to the user, how can the user still get the content...