Skip to content

Commit b82aeb4

Browse files
route443shawnhankim
authored andcommitted
Fix: Double URL encoding in proxy upstream after internalRedirect
1 parent 57db98e commit b82aeb4

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

openid_connect.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,11 @@ var newSession = false; // Used by oidcAuth() and validateIdToken()
77

88
export default {auth, codeExchange, validateIdToken, logout};
99

10+
function retryOriginalRequest(r) {
11+
delete r.headersOut["WWW-Authenticate"]; // Remove evidence of original failed auth_jwt
12+
r.internalRedirect(r.variables.uri + r.variables.is_args + (r.variables.args || ''));
13+
}
14+
1015
function auth(r) {
1116
if (!r.variables.refresh_token || r.variables.refresh_token == "-") {
1217
newSession = true;
@@ -88,8 +93,7 @@ function auth(r) {
8893
r.variables.refresh_token = tokenset.refresh_token; // Update key-value store
8994
}
9095

91-
delete r.headersOut["WWW-Authenticate"]; // Remove evidence of original failed auth_jwt
92-
r.internalRedirect(r.variables.request_uri); // Continue processing original request
96+
retryOriginalRequest(r); // Continue processing original request
9397
}
9498
);
9599
} catch (e) {

0 commit comments

Comments
 (0)