From 3c394844236fe78d7d9499c35861345dcff5212a Mon Sep 17 00:00:00 2001 From: Simonas Karuzas Date: Wed, 9 Dec 2020 18:49:31 +0200 Subject: [PATCH] fix(daf-express): Fix behavior of CLI HTTPS server behind proxy (#292) --- packages/daf-express/src/api-schema-router.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/daf-express/src/api-schema-router.ts b/packages/daf-express/src/api-schema-router.ts index 57a5ab172..48dc1d402 100644 --- a/packages/daf-express/src/api-schema-router.ts +++ b/packages/daf-express/src/api-schema-router.ts @@ -51,7 +51,7 @@ export const ApiSchemaRouter = (options: ApiSchemaRouterOptions): Router => { router.get('/', (req: RequestWithAgent, res) => { if (req.agent) { const openApiSchema = getOpenApiSchema(req.agent, '', options.exposedMethods) - const url = req.protocol + '://' + req.hostname + options.basePath + const url = (req.headers['x-forwarded-proto'] || req.protocol) + '://' + req.hostname + options.basePath openApiSchema.servers = [{ url }] if (options.securityScheme && openApiSchema.components) {