Skip to content

Commit 336dec6

Browse files
authored
fix: clarify BASE_URL startup message for HTTPS/CSRF misconfig
1 parent 889aca1 commit 336dec6

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

app.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -352,7 +352,10 @@ app.listen(app.get('port'), () => {
352352

353353
if (!BASE_URL.startsWith('http://localhost')) {
354354
console.log(
355-
`The BASE_URL env variable is set to ${BASE_URL}. If you directly test the application through http://localhost:${app.get('port')} instead of the BASE_URL, it may cause a CSRF mismatch or an Oauth authentication failure. To avoid the issues, change the BASE_URL or configure your proxy to match it.\n`,
355+
`The BASE_URL environment variable is set to ${BASE_URL}.
356+
If you open the app directly at http://localhost:${app.get('port')} instead of via your HTTPS-terminating endpoint (e.g., ngrok, Cloudflare, or similar), CSRF checks may fail and OAuth sign-in will be rejected due to a redirect mismatch.
357+
To avoid this, set BASE_URL to the HTTPS endpoint and always access the app through it in your browser.
358+
`,
356359
);
357360
} else if (app.get('port') !== port) {
358361
console.warn(`WARNING: The BASE_URL environment variable and the App have a port mismatch. If you plan to view the app in your browser using the localhost address, you may need to adjust one of the ports to make them match. BASE_URL: ${BASE_URL}\n`);

0 commit comments

Comments
 (0)