Troubleshooting Random Connection Errors with a WAF/CDN
There are instances where a connection might fail. It could be the NOC network, it could be your server. This is a quick way to troubleshoot the issue and identify where the problem is originating from.
While posting an article in WordPress a random error was presented:
The server logs don't tell us much, so we turn to the next logical issue - THE CDN/WAF!!?!?!?!?!?!?
While this might be true, this might also be false. Let's see if we can't identify what is going on.
Step 1. Google Developer Tools
Google offers this really cool feature, developer tools (access by clicking CTRL + SHIFT + I). Open dev tools, and click on the "Network" tab.
Once there, hit the action on the page to initiate the post request. In my example, I clicked "publish". For you, it could be refreshing the page.
This will record all the traffic in the dev tools panel.
Step 2. Identify & Remediate Errors
in the image above you quickly see that an error is being generated when the application tries to communicate with api-fetch.min.js.
Click on the row entry and a whole new world of data will be presented to you:
You'll notice that when the POST request is sent it is receiving a 403 (forbidden) response code. That's why the POST request is failing. Interesting, but what is generating the 403?
Click on "response" tab and you'll get the response being sent to your application:
Just like that you see what is going on. The NOC CDN / WAF is blocking the request via it's XSS rules.
Now you can go back to your CDN / WAF provider and say, "Yes, it is your fault!!!"
But seriously, be kind, these things happen and the steps outlined above go a long way to helping everyone get to the bottom of the issue.