fix: Trust X-Forwarded headers in the IDP

This commit is contained in:
Joachim Van Herwegen 2021-07-26 13:59:09 +02:00
parent 41694a171d
commit 2df3f1f28c
2 changed files with 7 additions and 2 deletions

View File

@ -101,7 +101,10 @@ export class IdentityProviderFactory implements ProviderFactory {
// Render errors with our own error handler
this.configureErrors(config);
return new Provider(this.baseUrl, config);
// Allow provider to interpret reverse proxy headers
const provider = new Provider(this.baseUrl, config);
provider.proxy = true;
return provider;
}
/**

View File

@ -79,7 +79,9 @@ describe('An IdentityProviderFactory', (): void => {
it('creates a correct configuration.', async(): Promise<void> => {
// This is the output of our mock function
const { issuer, config } = await factory.getProvider() as unknown as { issuer: string; config: Configuration };
const provider = await factory.getProvider() as any;
expect(provider.proxy).toBe(true);
const { issuer, config } = provider as { issuer: string; config: Configuration };
expect(issuer).toBe(baseUrl);
// Copies the base config