Q:1. http requests from cron jobs can be logged but not blocked?’
A:1. Generally no, but some limitations are removed. Requests in cron job are not limited by 3 requests per page and 3 second page time. It is done to avoid blocking some important API requests that are not directly slowing down admin pages. Because cron is built to handle slow processes. Plugin will not block requests in cron unless they are not explicitly blocked by any “Custom rule” in “Smart block” mode. Other blocking modes will not allow any requests in cron job that are not permitted by given mode.
- In “smart block” mode http requests will not be blocked if the are not blocked by any custom rule. For example if you add custom rule to block example.com domain or example-plugin everywhere then it will be blocked in cron as well.
- In “Block external requests” mode all external requests will be blocked even in cron job.
- In “Block external requests (allow www.remarpro.com only)” mode all external and not www.remarpro.com request will be blocked in cron job as well.
Q:2. would be cool if these could be blocked to in “Smart block”, “Block external requests” and “Block external requests (allow www.remarpro.com only)“
-> i recognized that “Snitch” blocked more…and than i realized to these blockings came from cron jobs…
A:2. Most HTTP requests inside cron job will not be blocked in smart block mode because cron job can run for long time without effecting user experience (pages that admin or visitors are viewing).
Behavior of HTTP requests in each blocking mode explained above in A:1.
Q:3. would also be cool to have an option “Block external requests” WITHOUT smart block and “Block external requests (allow www.remarpro.com only)” WITHOUT smart block
-> sometimes a cron job needs to be fullfilled and the smart block rules restrict important cron jobs..
A:3. Cron jobs are initiated as a WP_HTTP request. If for any reason cron job is not run on current page then it will run on next page. For example if page is slow and loads for more than 3 seconds then cron job request from that page will be blocked. On any next page request cron job will run if page is faster than 3 seconds.
You can use custom rules to perform similar behavior.
Example 1: block external requests without applying smart block restrictions:
1) Select “smart block” mode.
2) Custom rule 1: Allow domain yourdomain.com
3) Custom rule 2: Block all requests.
This way 3 second page limit and 3 requests per page will not apply to yourdomain.com. All other external requests will be blocked.
Example 2: Allow WordPress and your domain, block everything else without restricting 3 requests per page and 3 second page time.
1) Select “smart block” mode.
2) Custom rule 1: Allow domain yourdomain.com
3) Custom rule 2: Allow domain api.www.remarpro.com
4) Custom rule 3: Allow domain downloads.www.remarpro.com
5) Custom rule 4: Block all requests.
Q:4. What can happen to a site if these following rules are used is that a site could be damaged am I right?
- Page processing time exceeded 3 seconds.
- Number of request for single page reached 3.
- Sets timeout for each request to 1 second.
- Sets number of redirects for request to 1.
A:4. WordPress “core” functionality is not effected by this restrictions. Plugins relying on critical API requests like sending mail, getting data from remote server can break because of these restrictions. In such cases you can monitor all requests for some period and then allow requests to those important domains or by related plugins adding custom rule in smart block mode.
Also WP_HTTP requests are not 100% reliable. Request can fail for multiple reasons like temporary network problem or remote server problem. Plugin developers should know it and retry failed requests ideally after some time inside other page request.
Purpose of this plugin is to block not important external requests on slow pages like loading news/ads/upsells/promotions related to other plugins and themes. This plugin will let you see how they slow down your admin and front end pages.
Thank you for these questions. Sometime it is hard to make clear how plugin will handle request depending on multiple factors.
Regards.