Been playing with CF Workers for custom CF cache with additional headers added. But seems this only works with HTTP/2. If I test with Canary web browser and HTTP/3, then the custom CF Worker cache and additional headers do not show up and show the cache control settings from my origin server instead.
Hi @eva2000, Workers are (supposed to be) agnostic to what HTTP version the client speaks to our edge. If your script appears to behave differently based on the client protocol, it’s probably worth a support ticket. (Off the top of my head, I can’t think of any reason for the discrepancy.)
From my CF logs, looks like HTTP/3 based requests are causing my CF Worker to error out with exceptions
For inspecting CF logs for my request = /styles/default/xenforo/clear.png
HTTP/3 requests for last 5 hrs of CF logs with WorkerStatus = exception so it bypassed the CF Worker cache custom rules/headers and request from my origin CF cache rules
find . -mmin +300 -exec pzcat {} \; | jq -r 'select(.ClientRequestHost == "domain.com" and .ClientRequestProtocol == "HTTP/3" and .ClientRequestPath =="/styles/default/xenforo/clear.png" and .ClientCountry == "us" ) | "\(.ClientCountry) \(.EdgeResponseStatus) \(.CacheResponseStatus) \(.ClientASN) \(.ClientIPClass) \(.ClientRequestProtocol)-\(.OriginSSLProtocol) \(.ClientRequestMethod) \(.ClientRequestPath) \(.EdgePathingOp)-\(.EdgePathingSrc)-\(.EdgePathingStatus)-\(.EdgeRateLimitAction) \(.FirewallMatchesActions)-\(.FirewallMatchesRuleIDs)-\(.FirewallMatchesSources) \(.WAFAction)-\(.WAFRuleID) [\(.WorkerStatus)-\(.WorkerSubrequest)-\(.WorkerSubrequestCount)] \(.ClientRequestUserAgent)"' | sort -n | uniq -c | sort -rn | head -n20
14 us 200 200 701 noRecord HTTP/3-unknown GET /styles/default/xenforo/clear.png wl-macro-nr- []-[]-[] unknown- [exception-false-2] Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/85.0.4158.4 Safari/537.36
2 us 304 304 701 noRecord HTTP/3-unknown GET /styles/default/xenforo/clear.png wl-macro-nr- []-[]-[] unknown- [exception-false-2] Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/85.0.4158.4 Safari/537.36
while HTTP/2 requests so WorkerStatus = ok
find . -mmin +300 -exec pzcat {} \; | jq -r 'select(.ClientRequestHost == "domain.com" and .ClientRequestProtocol == "HTTP/2" and .ClientRequestPath =="/styles/default/xenforo/clear.png" and .ClientCountry == "us" ) | "\(.ClientCountry) \(.EdgeResponseStatus) \(.CacheResponseStatus) \(.ClientASN) \(.ClientIPClass) \(.ClientRequestProtocol)-\(.OriginSSLProtocol) \(.ClientRequestMethod) \(.ClientRequestPath) \(.EdgePathingOp)-\(.EdgePathingSrc)-\(.EdgePathingStatus)-\(.EdgeRateLimitAction) \(.FirewallMatchesActions)-\(.FirewallMatchesRuleIDs)-\(.FirewallMatchesSources) \(.WAFAction)-\(.WAFRuleID) [\(.WorkerStatus)-\(.WorkerSubrequest)-\(.WorkerSubrequestCount)] \(.ClientRequestUserAgent)"' | sort -n | uniq -c | sort -rn | head -n20
34 us 200 200 16509 noRecord HTTP/2-unknown GET /styles/default/xenforo/clear.png wl-macro-nr- []-[]-[] unknown- [ok-false-1] Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.61 Safari/537.36
28 us 200 200 701 noRecord HTTP/2-unknown GET /styles/default/xenforo/clear.png wl-macro-nr- []-[]-[] unknown- [ok-false-1] Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.61 Safari/537.36
The issue is gone now for the past few months. But not sure if it’s related to me removing some code (mentioned below) from my CF Workers which removed a lot of my Worker exception errors too when related to enabling CF Enterprise’s cache prefetch with listed URL links in manifest.txt. I don’t use wrangler but direct Worker editor GUI so can’t using tail.
Some of the code I removed was for CF Enterprise account’s support for Enterprise cf fields. Now I think about it for request.cf.requestPriority, it would only be for HTTP/2 right as there’s no HTTP/3 equivalent right now?