Hey! I faced with issue using Cloudflare as a proxy for Omni. Omni frontend uses this workflow to download the image from the backend:
Check/trigger the creation of the image via a HEAD request to the /image/xxx route
Download the image via GET request
The problem is here, that Cloudflare caches all requests, and they convertHEAD request to GET request by default, which broke the authentication because payload contains the method too.
Solution
Cloudflare (and others I believe) support no caching behavior based on standard headers in the request, so we can just add the header Cache-Control: no-store to our HEAD request to bypass caching in CF.
Alternative Solutions
Currently, I bypass the caching by using Cloudflare caching rules with exceptions for all /image URIs, but it isn't very flexible.
Problem Description
Hey! I faced with issue using Cloudflare as a proxy for Omni. Omni frontend uses this workflow to download the image from the backend:
HEAD
request to the/image/xxx
routeGET
requestThe problem is here, that Cloudflare caches all requests, and they convert
HEAD
request toGET
request by default, which broke the authentication because payload contains the method too.Solution
Cloudflare (and others I believe) support no caching behavior based on standard headers in the request, so we can just add the header
Cache-Control: no-store
to our HEAD request to bypass caching in CF.Alternative Solutions
Currently, I bypass the caching by using Cloudflare caching rules with exceptions for all
/image
URIs, but it isn't very flexible.Notes
I will prepare PR to resolve this issue