Skip to content

Commit 24d4858

Browse files
emmaling27Convex, Inc.
authored andcommitted
Tolerate trailing slash in NEXT_PUBLIC_DEPLOYMENT_URL (#34172)
GitOrigin-RevId: 6be17891ef5b2c067af9091c4a25348da2349c38
1 parent fe11fb9 commit 24d4858

File tree

1 file changed

+5
-1
lines changed
  • npm-packages/dashboard-self-hosted/src/pages

1 file changed

+5
-1
lines changed

npm-packages/dashboard-self-hosted/src/pages/_app.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,11 @@ function App({
6464
App.getInitialProps = async ({ ctx }: { ctx: { req?: any } }) => {
6565
// On server-side, get from process.env
6666
if (ctx.req) {
67-
const deploymentUrl = process.env.NEXT_PUBLIC_DEPLOYMENT_URL;
67+
// Tolerate a trailing slash on the url e.g. https://example.com/ should be valid and stripped to https://example.com
68+
const deploymentUrl = process.env.NEXT_PUBLIC_DEPLOYMENT_URL?.replace(
69+
/\/$/,
70+
"",
71+
);
6872
if (!deploymentUrl) {
6973
throw new Error(
7074
"NEXT_PUBLIC_DEPLOYMENT_URL environment variable is not set",

0 commit comments

Comments
 (0)