Hi,
I’m trying to cache my sitemap.xml files, created via Yoast SEO and then cached via ZenCache Pro Auto-cache Engine, but for some reason it always gets blocked, so returns a 405 error.
I’ve checked through and allowed all HEAD requests, as it was being blocked in my security log, as per below:
[405 HEAD Request: January 8, 2016 - 1:26 pm] Event Code: BFHS-HEAD - HEAD Request Blocked Solution: http://forum.ait-pro.com/forums/topic/security-log-event-codes/ REMOTE_ADDR: 210.48.18.43 Host Name: ip-210-48-18-43.iconz.net.nz SERVER_PROTOCOL: HTTP/1.0 HTTP_CLIENT_IP: HTTP_FORWARDED: HTTP_X_FORWARDED_FOR: HTTP_X_CLUSTER_CLIENT_IP: REQUEST_METHOD: HEAD HTTP_REFERER: REQUEST_URI: /page-sitemap.xml QUERY_STRING: HTTP_USER_AGENT: WordPress/4.4; https://www.mysite.com
In the ZenCache settings it’s ‘Auto-Cache User-Agent String’ is ‘WordPress; zencache160103’
And so added in this code to the Custom Code Methods Filtered section in my .htacess file:
# REQUEST METHODS FILTERED # If you want to allow HEAD Requests use BPS Custom Code and copy # this entire REQUEST METHODS FILTERED section of code to this BPS Custom Code # text box: CUSTOM CODE REQUEST METHODS FILTERED. # See the CUSTOM CODE REQUEST METHODS FILTERED help text for additional steps. RewriteCond %{REQUEST_METHOD} ^(TRACE|DELETE|TRACK|DEBUG) [NC] RewriteRule ^(.*)$ - [F] # RewriteCond %{REQUEST_METHOD} ^(HEAD) [NC] # RewriteRule ^(.*)$ - [R=405,L]
From what I understand this should have allowed ALL HEAD requests – or not?? Yet it still shows as being blocked in my security log. Not sure what I’m doing wrong here, so all help appreciated!
Also ideally, I’d only want to allow the get HEAD request from the s2member plugin, and unsure how to do this – OR if I’m caching the sitemap.xml can I ‘whitelist’ this particular file so the bots can always access it anyway?
Many thanks,
j
OK, I think I’ve found the problem – possibly nothing to do the the HEAD request, but needing a change to the plugin firwall whitelist since updating the plugin. It looks like it might be OK now, but will update if not.
Cheers.