Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie
Hi there,
There is an issue with role permissions that is being worked on at the moment.
If you are having trouble with access or permissions on regional forums please post here to get access: https://www.boards.ie/discussion/2058365403/you-do-not-have-permission-for-that#latest

Help prevent image caching for website webcam

  • 22-11-2019 3:22pm
    #1
    Registered Users, Registered Users 2 Posts: 15,543 ✭✭✭✭


    I've been reading many many support websites on this and feel like I'm getting nowhere, I'm really stumped, if anyone has any sugggestions on how to make this work I'd really appreciate it.

    My weather website home page displays a static image which is updated every few minutes by ftp. The image is always named webcam.jpg.

    No matter what i do it seems i cannot make chrome or any other browser not load a cached image if the page has been visited before (other than using shift-f5 , regular refresh doesnt work).

    Unfortunately I cannot post the code in a bb code tag for some reason or cloudflare is blocking me - you can see the page i'm talking about at https://www.loughlinstown.ie/index.html (have a look at the header and script i've put on top of that for example of what i've been trying)


    What I'd like to have working is something like the link I got from the sat24 website to display their image : https://api.sat24.com/mostrecent/GB/visual5hdcomplete ->> how is this displaying anything ???
    Its maybe pulling timestamped images which I guess I could try and do (the images are pulled off my ip camera on a raspberry pi 2 running rasbian and then cron uploads to the website directory).
    It should be easy enough to append the time or a random number i think in rasbian to the filename but then that would present other issues - filling up space on the website host and also on my raspberry pi sd card and also how to call the new image name.

    I'm really struggling.

    Any help really appreciated!

    Have a weather station?, why not join the Ireland Weather Network - http://irelandweather.eu/



Comments

  • Registered Users, Registered Users 2 Posts: 16,414 ✭✭✭✭Trojan


    You need a HTTP header telling it not to cache. Experiment with these:

    Apache - add this to your .htaccess file:
    <files "webcam.jpg">
        Header set Cache-Control "no-cache"
    </files>
    
    Nginx - add this to your Nginx configuration file:
    location ~/path/to/webroot/webcam.jpg {
        add_header Cache-Control "no-cache";
    }
    


  • Registered Users, Registered Users 2 Posts: 15,543 ✭✭✭✭Supercell


    Trojan wrote: »
    You need a HTTP header telling it not to cache. Experiment with these:

    Apache - add this to your .htaccess file:
    <files "webcam.jpg">
        Header set Cache-Control "no-cache"
    </files>
    
    Nginx - add this to your Nginx configuration file:
    location ~/path/to/webroot/webcam.jpg {
        add_header Cache-Control "no-cache";
    }
    

    Cannot thank you enough Trojan, finally, its working!, really really grateful for your help.

    Have a weather station?, why not join the Ireland Weather Network - http://irelandweather.eu/



  • Registered Users, Registered Users 2 Posts: 16,414 ✭✭✭✭Trojan


    Excellent, delighted to hear it worked for you. If you want to give back, hit up my business socials linked in sig - any Likes/Shares/Comments/etc hugely appreciated as I am just getting this started. No obligation - I'm glad to help.


Advertisement