Nginx (static) cache: images - nginx

I develop a mobile app using some REST-API, so have a backend server on nginx.
I noticed, that after uploading a new image on my server, the old image remains for 1 minute (I've checked it with different browsers, devices - it's NOT a browser cache, but a server response). I also tried to fetch images directly (just .jpg) - didn't help.
I tried to add GET-parameter (/image.jpg?a=12341), but it doesn't help as well - the old image remains for a minute.
I found some solutions to disable cache on nginx for images, but I would like to use parameters (like .jpg?a=12342). Is it possible? Or is it better just to disable cache on nginx?

Related

My Cloudflare site is taking hours to load CSS

I created a domain on CloudFlare, a website with HTML and CSS, hosted my bucket with those files on S3, and integrated terraform for deployments. When I kick off terraform apply and run the aws cli command to update the S3 bucket, formatting changes like text show immediately but my CSS changes like font sizes and colors take several hours to be visible. How can I make both types of changes visible quickly?
I tried hard reloading my browser, clearing cache, and setting auto minify on cloudflare. I haven't tried gzipping my css and min.css files, a little afraid I might break something. I'm unfamiliar with front end development. Suggestions?
For a proxied ("orange clouded") DNS record, Cloudflare applies a default caching behaviour. This includes default cached file extensions such as CSS files. The default behaviour, caching and extensions cached are documented here.
When you do a release on your origin (S3 bucket), you could purge the cache so that the old cached versions are discarded and new ones will be pulled and cached. You can also override the cache behaviour by using Page Rules. By the way, Page Rules (and other Cloudflare settings) are also manageable via Terraform.

How do I get a css file to be reflect any updates in localhost on xampp?

I have an index.html and a CSS file that are part of a wider project I am working on and it appears that any amendments I make to the CSS file is not reflected in the localhost server. Does anyone know why this might be?
Your browser will request the html files and won't always load the newest files because they are being pulled out of the cache. The best way to reset the cache is to do ctrl + shift + r.
I would guess this is a cache issue. Simple test:
Reload the page using ctrl+f5 on your keyboard. If the css updates, then your browser is (correctly, usually) caching the css file.
If this is the case, you can set up xampp to send a no cache header always or disable caching on your browser. Depending on your browser, you may be able to disable the cache on a specific domain, so all files served by localhost are not cached.

Wordpress site slow at random intervals

I have a WordPress site hosted in a server. I also verified the server configs everything is perfect. No space or ram issues.
When I start to load my site URL. In my networks tab, I see that the first request was "instant-loan/" which took 1min and rest all requests come faster after that. Ofcourse they loaded from cache in the image I shared but if I open in incognito also the rest of the requests are in miliseconds. This happens in all pages,
What could be the issue here? I have been searching for a possible cause for a very long time.
I have performed a site performance test in google insights and GT. They both gave the same below results:
Page loading: 35sec.
They only say to optimize images and js content.
The total page size is 6mb.
214 requests are beeing processed.
[NEW EDIT]
Below is the performance result. It shows a lot of idle time and js image rendering seems to happen quite fast. A max of 4 sec to render, load the site. Thus I assume there is something wrong with the server. I have minified CSS and JS. Also, use compressed images only. Is this because of any mysql connection issue ?? Has anyone faced it?

Wordpress : To load all asset files coming from HTTP to HTTPS?

I'm using Wordpress HTTPS plugin to force Admin mode to run under HTTPS.Its fine for Admin Panel.
But still, once i'm under HTTPS mode, every front pages are broken because of, it is saying some front-pages Asset Files are coming as normal HTTP (without 'S') which are then getting blocked to load onto page.
Than resulted in rendering the page looking messy.
So to be more clear again,
When i call the site in HTTPS / SSL mode .. some asset files, like:
http://www.my-another-site.com/something.js
http://www.my-another-site.com/something.css
http://www.my-another-site.com/something.jpg
... etc
.. are BROKEN. (Because i'm in https mode and those above files are coming as http)
So how to make Wordpress to FORCE LOAD those whatever files?(I DON'T CARE WHETHER IT IS SECURE OR NOT. Just want the site under https://... to be rendering properly.)
You could try using a protocol relative URL (dropping both the http and https from the URLs) - see this answer.
According to this answer you'll need to be on a recent version of WordPress (I'd assume 3.5) for it to work with wp_enqueue_script.

Make Apache Web Server load new images and CSS

How to make apache web server dynamically load new CSS and images? The purpose is to change the look and feel of portals in a cluster of load balanced web server instances, dynamically. I get a list of files that are changed and would be pushing to web server instances. Now the web server should, display the new CSS and images instead of old or cached.
Please let me know what changes I have to make in the html, apache server settings, cache settings etc. to make this happen.
Thanks in advance.
Ranjith
Get a list of changes built up, and flush the entire cache. This is the least headache way to do it.

Resources