Add skip-auth-preflight flag to allow OPTIONS requests through proxy (#7284)

This commit is contained in:
helgehatt
2025-04-14 21:27:02 +02:00
committed by GitHub
parent 9045919d2b
commit bbf2e24648
6 changed files with 34 additions and 1 deletions

View File

@@ -26,7 +26,9 @@ export async function proxy(
): Promise<void> {
ensureProxyEnabled(req)
if (!(await authenticated(req))) {
if (req.method === "OPTIONS" && req.args["skip-auth-preflight"]) {
// Allow preflight requests with `skip-auth-preflight` flag
} else if (!(await authenticated(req))) {
// If visiting the root (/:port only) redirect to the login page.
if (!req.params.path || req.params.path === "/") {
const to = self(req)