Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OIDC issuer behind a proxy cannot be accessed #1363

Open
wants to merge 8 commits into
base: main
Choose a base branch
from
2 changes: 1 addition & 1 deletion app/server/lib/OIDCConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ export class OIDCConfig {

this._redirectUrl = new URL(CALLBACK_URL, spHost).href;
custom.setHttpOptionsDefaults({
agent: issuerUrl !== undefined ? proxyAgent(new URL(issuerUrl)) : undefined,
...(issuerUrl !== undefined ? {agent: proxyAgent(new URL(issuerUrl))} : {}),
tristanrobert marked this conversation as resolved.
Show resolved Hide resolved
...(httpTimeout !== undefined ? {timeout: httpTimeout} : {}),
});
await this._initClient({ issuerUrl, clientId, clientSecret, extraMetadata });
Expand Down
4 changes: 3 additions & 1 deletion test/server/lib/OIDCConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ describe('OIDCConfig', () => {
[
{
itMsg: 'when omitted should not override openid-client default value',
expectedUserDefinedHttpOptions: {}
expectedUserDefinedHttpOptions: { agent: undefined }
},
{
itMsg: 'should reject when the provided value is not a number',
Expand All @@ -213,6 +213,7 @@ describe('OIDCConfig', () => {
},
shouldSetTimeout: true,
expectedUserDefinedHttpOptions: {
agent: undefined,
timeout: 10000
}
},
Expand All @@ -222,6 +223,7 @@ describe('OIDCConfig', () => {
GRIST_OIDC_SP_HTTP_TIMEOUT: '0',
},
expectedUserDefinedHttpOptions: {
agent: undefined,
timeout: 0
}
tristanrobert marked this conversation as resolved.
Show resolved Hide resolved
}
Expand Down