didierfred/SimpleModifyHeaders

Filter by HTTP method

Opened this issue · 0 comments

It would be useful to be able to filter not only by URL, but also by HTTP request method.

My specific use case is simulating intermittent error responses which succeed a CORS pre-flight check (OPTIONS method), but are missing CORS headers on the actual POST or GET error response. For now I've simply added a

    if (`${e.method}`.toUpperCase() === "OPTIONS") {
        // keep CORS pre-flight responses intact
        log("leaving cors preflight intact")
        return {responseHeaders: e.responseHeaders};
    }

to function rewriteResponseHeader(e) locally, and loaded the add-on via about:debugging, which works just fine for this specific case.