I think it is not possible, but I will ask experienced people for advice.
Imagine the situation:
- A client send a request to get a content A, i.e. www.server.com/content/1.
- A server process the request, and generate a redirect link (every request = new link). A process of generating the redirect link is a quite expensive.
- The server send response 302 Found to the client. The response contains Location, Expires, ETag and Last-Modified headers and also payload with hypertext (https://www.rfc-editor.org/rfc/rfc7231#section-6.4.3).
- The client is redirected to the new URL (www.server2.com/c/212123123/1) where can obtain the content A.
When the client again send request to the server (www.server.com/content/1) - point #1 - the browser uses cached 302 Found and instantly go to the URL from point #4 (www.server2.com/c/212123123/1).
The point is, the cached 302 Found can be outdated. Intended behavior is that the client firstly send request with If-Modified-Since and If-None-Match headers to the server which has two options:
- the URL is up-to-date = send 304 Not Modified
- the URL is outdated and server regenerate the URL and send new 302 Found
Than the client:
- Use cached 302 Found (server send 304 Not Modified)
- Use new 302 Found
The question is: Is possible to check whether is 302 Found still valid, i.e. server response with 304 Not Modified or with new 302 Found? A lot of time spend but it does not work. Thanks.