async function authorizationRedirectMiddleware(event, next) {
// The request objects are not directly mutable, so we have to create our
// own copy, using the existing headers and request as a base.
const headers = new Headers(event.request.headers);
headers.set('My-Custom-Request-Header', 'something');
const request = new Request(event.request, {
// Move on to the next middleware, or built-in behavior. When this promise
// resolves, we have already received the initial response from the origin
// server (or the cache.)
const response = await next(request);
response.headers.set('A-Different-Response-Header', 'another-thing');
// If you wanted to, you could even return a totally different response.