From 57b0a52f274621b9cc9a794d53cd7f4304b95ba2 Mon Sep 17 00:00:00 2001 From: John Conley Date: Tue, 11 Dec 2018 12:33:19 -0600 Subject: [PATCH] fix: support PATH_PREFIX --- src/albAdaptor.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/albAdaptor.ts b/src/albAdaptor.ts index 7b179c2..2cab3bb 100644 --- a/src/albAdaptor.ts +++ b/src/albAdaptor.ts @@ -3,6 +3,7 @@ import {ApiRequest, ApiResponse, ApiServer, HttpMethod, ValoryMetadata} from "va import {ALBRequestEvent, ALBResponse, Callback, Context, FormattedRequest} from "./types/alb"; import qs = require("querystring"); +const prefix = process.env.PATH_PREFIX; const pathReplacer = /{([\S]*?)}/g; const default404: ALBResponse = { statusCode: 404, @@ -72,7 +73,7 @@ export class ALBAdaptor implements ApiServer { method: event.httpMethod, isBase64Encoded: event.isBase64Encoded, queryStringParameters: event.queryStringParameters, - url: event.path, + url: event.path.replace(prefix, ""), }; this.router.lookup(formatted, cb); }