Did you read the body before you transform it?
Did you read the body before you transform it?
wrangler pages build I think? And then you have to call next() yourself and it's a mess rn)

console.log('Incoming element: ', JSON.stringify(element, null, 2))on() is what the rewriter will read, everything else ignored. So if I do HTMLRewriter().on('*', new ElementHandler()) then filter for element with tagName "article" inside the ElementHandler class, it's the same as HTMLRewriter().on('article', new ElementHandler())?* then filtering (is my understanding)
object Object logs[pages:err] GET /: Error: Please use a HTTPS connection. for example.https detection stuff real quick, I can get through the basic auth without issue fetch requests can be mutable, whereas in prod they're not. There's various issues to resolve this (and I think it's mostly resolved now), but for safety you may want to clone the response before mutating the headers, like this:new Response(response.body, response)?
7148cf4558a76f2f-SCL (boo), 7148c9e2de03ab38-EZE (yay) and 7148c2165e46694b-FRA (yay)-SCL; here's a ray id that threw a worker error (1101): 7148a5d07dc62ded_worker.js seems to be returning an empty 200 response in certain colos only (same deployment), Ray IDs are above.wrangler pages buildnext()console.log('Incoming element: ', JSON.stringify(element, null, 2))on()HTMLRewriter().on('*', new ElementHandler())ElementHandlerHTMLRewriter().on('article', new ElementHandler())*object Object[pages:err] GET /: Error: Please use a HTTPS connection.httpsnew Response(response.body, response)7148cf4558a76f2f-SCL7148c9e2de03ab38-EZE7148c2165e46694b-FRA-SCL7148a5d07dc62ded_worker.js const oldResponse = await next()
const contentType = oldResponse.headers.get('Content-Type')
if (contentType && contentType.startsWith('text/html')) {
const newResponse = handler.transform(oldResponse)
return oldResponse
}class UnauthorizedException extends Error {
constructor(reason) {
super(reason);
this.status = 401;
this.statusText = 'Unauthorized';
this.reason = reason;
}
}
class BadRequestException extends Error {
constructor(reason) {
super(reason);
this.status = 400;
this.statusText = 'Bad Request';
this.reason = reason;
}
}const response = await next();
response.headers.set('Cache-Control', 'no-store');
return response;const response = await next();
const newResponse = response.clone();
newResponse.headers.set('Cache-Control', 'no-store');
return newResponse;npx wrangler pages dev dist --kv appleDatanpx wrangler pages dev dist --kv APPLE_DISTRIBUTIONawait env.appleData.get('APPLE_DISTRIBUTION');await env.APPLE_DISTRIBUTION.get('...');Incoming element: {
"ptr": 1298176
}