Cover photo / Profile photo not changing on upload



  • Hey all,

    I have an issue which seems to relate to both browser AS WELL AS server side caching. Essentially the user uploads a new profile photo (or cover photo) they navigate to a different page and still see the profile photo they chose. When they navigate back to their profile the photo changes back to their original photo. When using a browser in incognito mode I am able to see that their profile picture never changed.

    I do not get back any form of failure / error to troubleshoot this issue. In fact I get back a 200 from the following url, the URL also returns the uploaded pic.

    https://<URL>/assets/uploads/profile/1-profileavatar.jpeg?1587402445550

    Any idea what might be happening here? Have tried restarting / rebuilding to solve to no avail.


  • Plugin & Theme Dev Community Rep

    Are you perhaps using Cloudflare? I had quite a few problems with their cache and here are some fixes/workarounds:

    1. Make sure caching level isn't set to Ignore Query Strings (in cachesettings of you cloudflare site)
    2. Set Browser Cache TTL to Respect Existing Headers (in cache settings of you cloudflare site)
    3. Go to Page Rules and create a new rule. Input your forum url followed by /assets/uploads/profile/* (or just assets/uploads/* if you don't feel like you need cloudflare caching your files at all), select setting Cache Level and set it to Bypass. Save and deploy.
    4. Possibly the most hacky thing I deployed and will quite honestly get rid of in favor of just not using cf cache for it (not sure why I thought I needed that cache for category images) - you can create an API key for single cloudflare zone with permission to purge cache. Then just create a plugin (less hacky)/modify core (more hacky; guess what I chose...) to make a POST request to cloudflare API containing header with Authorization: Bearer <token> and json body with url of new file: files: ["<url>"] whenever an image is uploaded. If you want I can share the code I used, though it was made for categori picture uploads and not profile pictures and I don't really recommend it.


  • @oplik0 said in Cover photo / Profile photo not changing on upload:

    /assets/uploads/profile/*

    Cheers, thanks for the response,

    I was able to get around things by adding a custom path to page rules -> cache level -> bypass for https://secret-internet.club/assets/uploads/profile/ which seems to catch both the www and non www of the site.

    Thanks a lot for your assistance.


  • Plugin & Theme Dev Community Rep

    The funny thing here is that I just noticed that I broke my page rule for bypassing cache on accident some time ago (made a typo) and it wasn't working, and here I am helping someone deal with a problem I didn't actually solve until now XD


Log in to reply
 

Suggested Topics

  • 2
  • 3
  • 9
  • 9
  • 5
| |