From 6e159718b1ee8ec1a37ad8c239af216187511b35 Mon Sep 17 00:00:00 2001 From: Martin Kleinschrodt Date: Mon, 25 Jul 2022 08:45:08 +0200 Subject: [PATCH] Fix path parsing in case stripe server is hosted on a subpath --- packages/server/src/provisioning/stripe.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/server/src/provisioning/stripe.ts b/packages/server/src/provisioning/stripe.ts index 47ddf5f2..d9230be4 100644 --- a/packages/server/src/provisioning/stripe.ts +++ b/packages/server/src/provisioning/stripe.ts @@ -1464,7 +1464,7 @@ export class StripeProvisioner extends BasicProvisioner { protected async _handleRequest(httpReq: IncomingMessage, httpRes: ServerResponse) { const path = new URL(httpReq.url!, "http://localhost").pathname; - if (path === "/stripe_webhooks") { + if (path.endsWith("/stripe_webhooks")) { if (httpReq.method !== "POST") { httpRes.statusCode = 405; httpRes.end(); @@ -1474,7 +1474,7 @@ export class StripeProvisioner extends BasicProvisioner { return this._handleStripeEvent(httpReq, httpRes); } - if (path === "/sync") { + if (path.endsWith("/sync")) { if (httpReq.method !== "POST") { httpRes.statusCode = 405; httpRes.end(); @@ -1484,7 +1484,7 @@ export class StripeProvisioner extends BasicProvisioner { return this._handleSyncBilling(httpReq, httpRes); } - if (path === "/portal") { + if (path.endsWith("/portal")) { if (httpReq.method !== "GET") { httpRes.statusCode = 405; httpRes.end(); @@ -1494,7 +1494,7 @@ export class StripeProvisioner extends BasicProvisioner { return this._handlePortalRequest(httpReq, httpRes); } - if (path == "/callback") { + if (path.endsWith("/callback")) { if (httpReq.method !== "GET") { httpRes.statusCode = 405; httpRes.end();