What am I doing
I remove the image from the database and send it to the browser with all the relevant headers - the image is displayed normally. I also send the ETag header using the SHA1 of the image content as a tag.
Images are obtained half regularly, so caching is a bit of a problem (it won’t kill the site, but it’s nice to have it).
Problem
$ _ SERVER ['HTTP_IF_NONE_MATCH'] is not available to me. As far as I can tell, this is because the PHP "disobeying cache" lifestyle is not supported. I cannot communicate with the session cache limiter because I do not have access. But even if I had access, I would not want to touch it: 99% of the site is under WordPress.
Wednesday
Any guidance, hints / tricks, etc. would be helpful. I have few opportunities to change environmental / structural material.
Greetings.
Have you tried reading HTTP_IF_NONE_MATCH from apache_request_headers () ?
If you are using pre-4.3 php, it used to be called getallheaders ().
Edit Now I see on the page I'm linked to that you can also try to put
RewriteEngine on RewriteRule .* - [E=HTTP_IF_MODIFIED_SINCE:%{HTTP:If-Modified-Since}] RewriteRule .* - [E=HTTP_IF_NONE_MATCH:%{HTTP:If-None-Match}]
in the corresponding .htaccess file to force Apache to set the PHP variables $ _SERVER [...] that you are trying to read unsuccessfully.
PHP If-None-Match, . , "PHP", "; PHP " ", , , , , , .
, , . , PHP, , Apache. PHP, Apache, - mod-rewrite, , ( !):
RewriteCond %{HTTP_IF_NONE_MATCH} (.+) RewriteRule ^/get_image.php /get_image.php?if-none-match=%1 [B,QSA]
Source: https://habr.com/ru/post/1744861/More articles:Outdated pear installation errors - phpHow to count newlines in Internet Explorer? - javascriptselect n largest using LINQ - c #Line output Labview - stringРазрешение двусмысленного указателя на С++ - c++One to two relationships in the Doctrine with YAML - mysqlGiven an array of arrays, how can I cut the substring "GB" from each value? - substringListen to Apple.caf sound file on a web server? - audioUnable to place breakpoint in gdb in emacs - cCannot find method in action - androidAll Articles