pmeenan / cf-workers Goto Github PK
View Code? Open in Web Editor NEWCollection of Cloudflare Workers
License: MIT License
Collection of Cloudflare Workers
License: MIT License
Found the difference: my bad!
streaming-optimizations - Combined set of scripts to operate on streaming responses. This is a subset of the optimizations that doesn't include any workers that need the full HTML response to work.
optimization-pack - Collection of all optimizations in a single worker. This operates on blocking responses and processes the full HTML with no streaming which can cause pages that rely on early flushing to perform slower (rare but worth being aware of).
The recent commits to the streaming optimizations has an error leading to console warnings in the worker editor.
// Bypass processing for image requests (for most browsers, Firefox doesn't include image/* on the accept)
if (!isImage) {
const url = new URL(event.request.url);
if (event.request.method === 'GET' && isProxyRequest(url)) {
// Pass the requests through to the origin server
// (through the underlying request cache and filtering headers).
event.respondWith(proxyRequest('https:/' + url.pathname + url.search, csp.request));
} else {
event.respondWith(processRequest(event.request, event));
}
}
});
CSP is not defined in the above block (around line 37)
The last update that introduced const ENABLE_REWRITE_DOMAINS = true; doesn't seem to be working correctly atleast when I tested it on a website with wordpress.com's cdn proxying images.
When I had the domain being proxied all images were returning a 404 and with a CF-Cache-Status: ByPass.
I attempted reloading the page a few times to no avail so I ended up commenting out the line for wp.com images for now. The rewriting of the urls in the HTML worked as expected but it was an issue with the response returning a 404.
How about adding Cloudflares image resizing into the worker. Would make a huge difference for users not using another alternative of adaptive images:
Hello !
Thank you for this code.
But i am looking for implement it for Magento2 store..
Anybody knows How to implement this code for Magento2 ?
It would be awesome!
I have tried some conf without success..
The list of cookie used by magento2
I was able to bypass with page rules admin area, cart, customers account etc...
But with full page cache of cloudflare i had an issue on product page to pull a reviews..
I always had log in for a reviews due to full page cache. I am not surprised.
Thank you for your advises or Helps !!
Sorry, not a JS coder.
I only know how to implement it on Nginx.
fastcgi_cache_bypass $http_x_no_cache_control;
Thank you.
HI @pmeenan any plans on updating your example cf-worker scripts to support Cloudflare's new API token method https://blog.cloudflare.com/api-tokens-general-availability/ where CF Global API Keys are currently used ?
Facing issue on wordpress login if login redirection is not on wp-admin page.
The set-cookie
header is not propagated from server when bypassing cache in cache-bypass-on-cookie.
It doesn't work, the seperate scripts work though
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.