test
This commit is contained in:
parent
44b914d8bb
commit
4d29bfebc5
@ -18,19 +18,19 @@ export function onRequest(context) {
|
||||
url.port = "";
|
||||
|
||||
// If the path is just /v2 then redirect upstream
|
||||
if (url.pathname == "/v2" || url.pathname == "/v2/") {
|
||||
return Response.redirect(TARGET_URL.toString(), 302);
|
||||
}
|
||||
// if (url.pathname == "/v2" || url.pathname == "/v2/") {
|
||||
// return Response.redirect(TARGET_URL.toString(), 302);
|
||||
// }
|
||||
|
||||
// If the path starts with an allowed user, redirect to the new url
|
||||
for (var user of ALLOWED_EXTRA_USERS) {
|
||||
if (url.pathname.startsWith(`/v2/${user}/`)) {
|
||||
return Response.redirect(url.toString(), 302);
|
||||
}
|
||||
}
|
||||
// // If the path starts with an allowed user, redirect to the new url
|
||||
// for (var user of ALLOWED_EXTRA_USERS) {
|
||||
// if (url.pathname.startsWith(`/v2/${user}/`)) {
|
||||
// return Response.redirect(url.toString(), 302);
|
||||
// }
|
||||
// }
|
||||
|
||||
// Inject the default user into the path after /v2/
|
||||
url.pathname = url.pathname.replace("/v2/", `/v2/${DEFAULT_USER}/`);
|
||||
// // Inject the default user into the path after /v2/
|
||||
// url.pathname = url.pathname.replace("/v2/", `/v2/${DEFAULT_USER}/`);
|
||||
|
||||
// Redirect to the new url
|
||||
return Response.redirect(url.toString(), 302);
|
||||
|
Loading…
x
Reference in New Issue
Block a user