Title: Bad directory structure logic for proxy scripts
Last modified: January 6, 2017

---

# Bad directory structure logic for proxy scripts

 *  Resolved [aamir2007](https://wordpress.org/support/users/aamir2007/)
 * (@aamir2007)
 * [9 years, 4 months ago](https://wordpress.org/support/topic/bad-directory-structure-logic-for-proxy-scripts/)
 * Hello,
 * Its a good plugin with lot of efforts to improve wordpress speed however I recently
   run into an issue that may not be raised before. I run out of Inodes on my VPS
   server. Upon investigating I came to know that /uploads/abovethefold/proxy/* 
   folder is consuming millions of inodes. That’s all due to the proxy cache is 
   not properly managed and some unnecessary sub directories are created and then
   these are not cleared when we clear cache. Or atleast they should be cleared 
   when we save plugin settings in proxy tab.
 * Also another serious issue is that I see lot of entries in my php slow log regarding
   above the fold proxy trying to download scripts via curl. It is not properly 
   handled may be you need to improve request headers and disable keep-alive header
   that may improve the curl performance.
 * Would really appreciate if above issues are addressed ASAP.
 * Regards,
    Aamir

Viewing 7 replies - 1 through 7 (of 7 total)

 *  Plugin Author [optimalisatie](https://wordpress.org/support/users/optimalisatie/)
 * (@optimalisatie)
 * [9 years, 4 months ago](https://wordpress.org/support/topic/bad-directory-structure-logic-for-proxy-scripts/#post-8626116)
 * Hi aamir2007,
 * Thank you for reporting the problem and for your extensive information!
 * There has been a report about the issue before ([@bluemad]([https://wordpress.org/support/topic/above-the-fold-proxy-folder-size-increase/](https://wordpress.org/support/topic/above-the-fold-proxy-folder-size-increase/)))
 * The proxy cache is currently fairly simple and there is no cleanup. It currently
   depends on the website admin / developer to proxy specific scripts. The cache
   will then remain stable and small.
 * The directory structure will keep the amount of files per directory under 2000
   to prevent an inode problem. However, the amount of cache files should remain
   low and stable by preventing scripts with a changing url to be cached by the 
   proxy.
 * If you use auto capture to proxy any script and if the website contains a script
   with a changing url, e.g. a timestamp query string, a new cache entry will be
   created for each request. The configuration page shows a solution to capture 
   such scripts by using a JSON config object.
 * > **JSON Proxy Config Object**
   >  JSON config objects enable advanced file based
   > proxy configuration. JSON objects can be used together with simple file entry
   > and must be placed on one line (no spaces are allowed). JSON config objects
   > must contain a target url (the url that will be downloaded by the proxy). Regular
   > expression enables to match a source URL in the HTML, e.g. an URL with a cache
   > busting date string (?time) or an url on a different host. Valid parameters
   > are url, regex, regex-flags, cdn and expire (expire time in seconds). Example:`{"
   > regex": "^https://app\\.analytics\\.com/file\\.js\\?\\d+$", "regex-flags":"
   > i", "url": "https://app.analytics.com/file.js", "expire": "2592000"}`
 * The regex in the example will capture scripts with the url [https://app.analytics.com/file.js](https://app.analytics.com/file.js)?**
   123456789** and create 1 cache entry.
 * Regarding your suggestion for cURL request optimization, the plugin uses the 
   WordPress method [wp_remote_get]([https://codex.wordpress.org/Function_Reference/wp_remote_get](https://codex.wordpress.org/Function_Reference/wp_remote_get))
   that automatically selects cURL or file_get_contents based on the server environment.
   We will investigate your tip to improve the performance by disabling keep-alive!
 * Based on your feedback, the proxy cache structure will be improved including 
   a clean up and a monitor to detect problems. It will be included in the next 
   version.
 * _[ [Signature moderated](http://codex.wordpress.org/Forum_Welcome#Signatures)]_
    -  This reply was modified 9 years, 4 months ago by [Jan Dembowski](https://wordpress.org/support/users/jdembowski/).
 *  Thread Starter [aamir2007](https://wordpress.org/support/users/aamir2007/)
 * (@aamir2007)
 * [9 years, 4 months ago](https://wordpress.org/support/topic/bad-directory-structure-logic-for-proxy-scripts/#post-8626142)
 * Hello Jan,
 * Thanks for the response. I will look into your suggestions.
 *  Plugin Author [optimalisatie](https://wordpress.org/support/users/optimalisatie/)
 * (@optimalisatie)
 * [9 years, 4 months ago](https://wordpress.org/support/topic/bad-directory-structure-logic-for-proxy-scripts/#post-8630041)
 * Hi Aamir,
 * Based on your feedback the proxy cache directory has been moved to `/wp-content/
   cache/` and the wp_remote_get implementation has been improved by disabling keep-
   alive in `v2.7.7`.
 * Thanks a lot for the suggestion!
 * _[ [Signature moderated](http://codex.wordpress.org/Forum_Welcome#Signatures)]_
    -  This reply was modified 9 years, 4 months ago by [Jan Dembowski](https://wordpress.org/support/users/jdembowski/).
 *  Thread Starter [aamir2007](https://wordpress.org/support/users/aamir2007/)
 * (@aamir2007)
 * [9 years, 4 months ago](https://wordpress.org/support/topic/bad-directory-structure-logic-for-proxy-scripts/#post-8630409)
 * Hello Jan,
 * Thanks for such quick response. I am closely following all the updates and features
   in this plugin from long time and I like it too.
    I have experience with curl
   so I know turning off keep-alive header improves the curl performance for single
   file download. Here is my site. [http://gilli.tv](http://gilli.tv)
 * While looking for Critical CSS, I was having issues setting up your solution 
   on my VPS, however I find Critical CSS Extractor chrome extension very helpful
   in this regard. It is very easy and quick way to generate critical css and produces
   ready to use css code. The only drawback I find is that I had to generate Criticla
   CSS for desktop and mobile screen separately and them mix them by adding css 
   queries.
 * Regards,
    Aamir Hussain Manager @ [http://gilli.tv](http://gilli.tv)
 *  Plugin Author [optimalisatie](https://wordpress.org/support/users/optimalisatie/)
 * (@optimalisatie)
 * [9 years, 4 months ago](https://wordpress.org/support/topic/bad-directory-structure-logic-for-proxy-scripts/#post-8630741)
 * Hi Aamir,
 * Thanks again for your feedback and tips! We are developing a new automated solution
   to create professional quality critical CSS for unlimited pages. It will be included
   in a new plugin.
 * I checked your website. You are just one step away from a Google PageSpeed 100
   score. The remaining issue is `Leverage browser caching` (HTTP cache headers).
 * W3 Total Cache includes a solution to automatically configure HTTP cache headers.
   _[
   [Signature moderated](http://codex.wordpress.org/Forum_Welcome#Signatures) ]_
    -  This reply was modified 9 years, 4 months ago by [Jan Dembowski](https://wordpress.org/support/users/jdembowski/).
 *  Moderator [Jan Dembowski](https://wordpress.org/support/users/jdembowski/)
 * (@jdembowski)
 * Forum Moderator and Brute Squad
 * [9 years, 4 months ago](https://wordpress.org/support/topic/bad-directory-structure-logic-for-proxy-scripts/#post-8631087)
 * _*Looks. Oh for goodness sake*_
 * Side note: [@optimalisatie](https://wordpress.org/support/users/optimalisatie/)
   please do not put signatures in your replies. I’ve already replaced 20 or so 
   of your replies with this.
 * _[ [Signature moderated](http://codex.wordpress.org/Forum_Welcome#Signatures)]_
 *  Moderator [Jan Dembowski](https://wordpress.org/support/users/jdembowski/)
 * (@jdembowski)
 * Forum Moderator and Brute Squad
 * [9 years, 4 months ago](https://wordpress.org/support/topic/bad-directory-structure-logic-for-proxy-scripts/#post-8631256)
 * Side side note: [@optimalisatie](https://wordpress.org/support/users/optimalisatie/)
   I’ve just redacted your signature from over 100 of your replies. This was not
   fun.
 * Please reply back to me that you understand and will refrain from signatures 
   going forward.

Viewing 7 replies - 1 through 7 (of 7 total)

The topic ‘Bad directory structure logic for proxy scripts’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/above-the-fold-optimization_fcfbf6.
   svg)
 * [Page Speed Optimization](https://wordpress.org/plugins/above-the-fold-optimization/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/above-the-fold-optimization/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/above-the-fold-optimization/)
 * [Active Topics](https://wordpress.org/support/plugin/above-the-fold-optimization/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/above-the-fold-optimization/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/above-the-fold-optimization/reviews/)

## Tags

 * [curl](https://wordpress.org/support/topic-tag/curl/)
 * [inodes](https://wordpress.org/support/topic-tag/inodes/)

 * 8 replies
 * 3 participants
 * Last reply from: [Jan Dembowski](https://wordpress.org/support/users/jdembowski/)
 * Last activity: [9 years, 4 months ago](https://wordpress.org/support/topic/bad-directory-structure-logic-for-proxy-scripts/#post-8631256)
 * Status: resolved