PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Saturday, February 5, 2022

[FIXED] NGINX return 410 for deleted CSS and JS files

 February 05, 2022     css, http-status-code-410, javascript, nginx, wordpress     No comments   

Issue

I have a problem with a plugin I've deleted, apparently the cache on the users browser still send request for some JS and CSS files that are gone, the problem is that this is causing a lot of 404 errors in the logs (in 1 day I generated 4GB of error logs only containing the 404 deleted CSS and JS files).

I was trying to create a setting on NGINX that will send a 410 response to everyone that was trying to access the missing JS and CSS files, the path of the files is the same:

/wp-content/cache/autoptimize/js/autoptimize_single_32ab5663ad75c559c9af68098a1b63e6.js

/wp-content/cache/autoptimize/css/autoptimize_32c1c99d8f7a5a9618074737134c8f9c.css

I tried various location settings I found online for both all files that contains autoptimize_*.css and js and the folder /autoptimize, but it didn't work, it was like this:

location ^~ /autoptimize { return 410; }

What I'm missing?


Solution

Try :

location ^~ /wp-content/cache/autoptimize/ { return 410; }


Answered By - Pedram Gholizadeh
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home
View mobile version

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing