Has anyone experienced errors with CloudFlare workers causing other URLs on the same hostname that don’t go to the worker also having the same error?
I have setup a CloudFlare worker as a reverse-proxy to return content from an origin server.
This worker is restricted to only work on a specific file-path, both using the worker route, and by the code in the worker checking the file-path of the request.
If the call to the origin server fails, then the call to the reverse-proxy worker on CloudFlare also fails with a HTTP error code of 526.
This is expected behavior, and not the problem. The problem is that if the reverse-proxy call fails with a 526 error, then the very next call to CloudFlare, regardless of file-path, will also fail with a 526 error. If I reload the URL again it will complete successfully, until I call the reverse-proxy worker and it returns a 526 error again.
Here’s an example of the problem (with fake URLs):
Reload the URL from #2 as many times as you want and it will load successfully.
Until you reload the URL from #1 and get the 526 again, at which point any URL will return a 526 error once.
Why would the call to the reverse-proxy failing result in all other calls to CloudFlare to fail?
I can fix the error in step #1 by installing the correct SSL certificate in the origin server, but I want my setup to be robust enough so the whole website is not brought down because the reverse-proxy is failing.
I updated the A record for ‘unrelentingsky.xyz’ (my domain) to be proxied, but am still seeing the issue.
I also looked through the Community Tip you linked, but none of that applies. To clarify, the issue is not with the Worker itself returning a 526 error. That is expected behavior and we can fix that by updating the origin server to return the correct SSL certificate. The problem is the Worker returning a 526 error causing the next call to the same hostname, regardless of file-path, to also return a 526 error.
You can repeat these steps as many times as you want and can see that the Worker responding with a 526 error is causing the very next call to the hostname, regardless of file-path to also return a 526 error.
Here’s a screenshot of my Route / Worker settings showing that the Worker should only be executing for the specific file-path:
This is most likely related to how Always Online is responding to the 526 being returned by the worker and attempting to serve a cached copy of the site. If you disable AO on the unrelentingsky.xyz site are you still able to reproduce this issue?
I have been communicating directly with customer support and we have determined that disabling Always Online stops this error.
However, I have not been provided with an explanation as to why the Always Online functionality results in this behavior - it does not make sense that a Worker returning a 526 error would result in all other calls to the same hostname returning a 526 error, and only for the next call.
I will continue to work directly with my customer support contact.