CodeNewbie Community

fosil
fosil

Posted on

If Modified Since HTTP Header In WordPress

The If-Modified-Since header is a request header, not a response header. As such, it is sent from the browser with the request and should not appear in the response. It would make no sense to implement this in a server-side plugin. The browser would simply ignore it.

This is essentially how it works in the client-server dialogue:

Browser:
I have a cached copy of this asset that has exceeded its expiry time. Send me the latest version, but only if it’s newer than my copy.
If-Modified-Since:

Server:
304 Not Modified (continue using your cached copy for now; I’ll save time and bandwidth by not sending you what you already have)
or
200 OK (the asset was changed since then, so here’s the new version)

If you have an access to the httpd.conf, you can add this line:
ServerTokens Prod

This will reduce the amount of information about your server software. So, if this is the server header value now:

Apache/2.4.35 (Win64) OpenSSL/1.1.0i PHP/7.2.11

Reference Blog
If Modified Since HTTP Header In WordPress

Discussion (0)