Bitcoin Forum
February 15, 2026, 10:10:50 AM *
News: Latest Bitcoin Core release: 30.2 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Image proxy caching problem  (Read 190 times)
LoyceV (OP)
Legendary
*
Offline Offline

Activity: 3948
Merit: 21199


Thick-Skinned Gang Leader and Golden Feather 2021


View Profile WWW
January 14, 2025, 09:33:50 AM
Last edit: January 14, 2025, 10:58:52 AM by LoyceV
Merited by ABCbits (2), Pmalek (2), vapourminer (1)
 #1

This image currently shows 95.79 USD (updated hourly), but when I embed it, I see (at the time of writing: 95.37 USD. A hard refresh or even private window doesn't change this, which makes me think it's cached by the forum's image proxy.

I expected this would still apply:
There is no caching on the bitcointalk.org side. The image is always passed directly from the source server to the user.
@theymos: did something change?



Any Expires or Cache-Control headers sent by the origin server are passed through as well, so caching might be done by the client.
This is the next problem I had, but I think I've solved this on my end. I've added this to my .htaccess (source):
Code:
<filesMatch "\.(gif|png|jpg)$">
  FileETag None
  <ifModule mod_headers.c>
     Header unset ETag
     Header set Cache-Control "max-age=0, no-cache, no-store, must-revalidate"
     Header set Pragma "no-cache"
     Header set Expires "Wed, 11 Jan 1984 05:00:00 GMT"
  </ifModule>
</filesMatch>

¡uʍop ǝpᴉsdn pɐǝɥ ɹnoʎ ɥʇᴉʍ ʎuunɟ ʞool no⅄
theymos
Administrator
Legendary
*
Offline Offline

Activity: 5838
Merit: 15179


View Profile
January 14, 2025, 08:44:23 PM
Merited by LoyceV (2)
 #2

Since that DDoS a while ago, the imageproxy is now going through Cloudflare, which will do server-side caching if allowed by the final origin's headers, and client Cache-Control headers are (I think) always ignored now. (I haven't decided yet whether having the imageproxy behind Cloudflare is permanent.)

That pricing image doesn't send any cache-related headers at all, aside from Last-Modified. If that .htaccess file is intended for that image, then it's not working. One major issue in this case is that:
 1. The image doesn't send an Expires header.
 2. If an image doesn't have an Expires header, then the imageproxy sets an Expires 1 day into the future. *
 3. Cloudflare then server-side-caches this for 1 day based on the Expires header, and there's no way for the client to bypass Cloudflare's cache.

* I just now changed the default Expires timeout to 10 minutes instead of 1 day, at least as long as the imageproxy is behind Cloudflare. But for live content like this, it'd be better if the origin sent headers disabling caching entirely.

1NXYoJ5xU91Jp83XfVMHwwTUyZFK64BoAD
LoyceV (OP)
Legendary
*
Offline Offline

Activity: 3948
Merit: 21199


Thick-Skinned Gang Leader and Golden Feather 2021


View Profile WWW
January 15, 2025, 09:25:19 AM
 #3

I just now changed the default Expires timeout to 10 minutes instead of 1 day, at least as long as the imageproxy is behind Cloudflare.
Thanks, for now, it works again.

Quote
But for live content like this, it'd be better if the origin sent headers disabling caching entirely.
I'll look into how to do this (starting by posting here).

¡uʍop ǝpᴉsdn pɐǝɥ ɹnoʎ ɥʇᴉʍ ʎuunɟ ʞool no⅄
joker_josue
Legendary
*
Offline Offline

Activity: 2296
Merit: 6610


**In BTC since 2013**


View Profile WWW
January 15, 2025, 08:39:16 PM
 #4

This image currently shows 95.79 USD (updated hourly), but when I embed it, I see (at the time of writing: 95.37 USD. A hard refresh or even private window doesn't change this, which makes me think it's cached by the forum's image proxy.

Just an observation. When trying to access the image directly in the browser, an error occurs and it is not possible.
Is it because the browser automatically assumes https, and the image is only in http?



I gave another tip in the other topic.

 
 b1exch.io 
  ETH      DAI   
  BTC      LTC   
  USDT     XMR    
.███████████▄▀▄▀
█████████▄█▄▀
███████████
███████▄█▀
█▀█
▄▄▀░░██▄▄
▄▀██▄▀█████▄
██▄▀░▄██████
███████░█████
█░████░█████████
█░█░█░████░█████
█░█░█░██░█████
▀▀▀▄█▄████▀▀▀
LoyceV (OP)
Legendary
*
Offline Offline

Activity: 3948
Merit: 21199


Thick-Skinned Gang Leader and Golden Feather 2021


View Profile WWW
January 16, 2025, 10:01:53 AM
 #5

When trying to access the image directly in the browser, an error occurs and it is not possible.
Is it because the browser automatically assumes https, and the image is only in http?
I blame modern browsers. When I click http://proxyimages.bitcoindata.science/, Firefox tries to open https, which doesn't work. But it works in a private window. On the same server, http://addresses.loyce.club/ works normally in Firefox.

The reason I'm not using https is because it's annoying.... Even when I set it up for automated updates, I've had it fail several times in the past. The data isn't that important, so I don't mind the unencrypted connection.

¡uʍop ǝpᴉsdn pɐǝɥ ɹnoʎ ɥʇᴉʍ ʎuunɟ ʞool no⅄
joker_josue
Legendary
*
Offline Offline

Activity: 2296
Merit: 6610


**In BTC since 2013**


View Profile WWW
January 16, 2025, 06:34:05 PM
 #6

When trying to access the image directly in the browser, an error occurs and it is not possible.
Is it because the browser automatically assumes https, and the image is only in http?
I blame modern browsers. When I click http://proxyimages.bitcoindata.science/, Firefox tries to open https, which doesn't work. But it works in a private window. On the same server, http://addresses.loyce.club/ works normally in Firefox.

The reason I'm not using https is because it's annoying.... Even when I set it up for automated updates, I've had it fail several times in the past. The data isn't that important, so I don't mind the unencrypted connection.

I understand perfectly.

They started with these theories that this obligation is safer for everyone. But in the end it made things easier for crooks to make fake websites.


 
 b1exch.io 
  ETH      DAI   
  BTC      LTC   
  USDT     XMR    
.███████████▄▀▄▀
█████████▄█▄▀
███████████
███████▄█▀
█▀█
▄▄▀░░██▄▄
▄▀██▄▀█████▄
██▄▀░▄██████
███████░█████
█░████░█████████
█░█░█░████░█████
█░█░█░██░█████
▀▀▀▄█▄████▀▀▀
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!