Skip to content

Commit 7475640

Browse files
committed
Removed final slash from FRACTAL_SERVER_HOST environment variable
1 parent 6db8035 commit 7475640

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

docs/environment-variables.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ The following environment variables can be used to configure fractal-web.
44

55
> Only when using `npm run dev` or `npm run preview` these variables are automatically read from `.env.development` and `.env` files. In production they must be set in the shell that starts the node process.
66
7-
* `FRACTAL_SERVER_HOST`: represents the URL of the fractal-server application (e.g. http://localhost:8000, or http://subdomain.example.org:8000); this variable is **required** and it should not contain a final slash;
7+
* `FRACTAL_SERVER_HOST`: represents the URL of the fractal-server application (e.g. http://localhost:8000, or http://subdomain.example.org:8000); this variable is **required**;
88
* `AUTH_COOKIE_NAME`: the name of the cookie used to store the user session; the default value is `fastapiusersauth`;
99
* `AUTH_COOKIE_DOMAIN`: specifies which server can receive the cookie; **remember to set it in production**;
1010
* `AUTH_COOKIE_PATH`: the URL path where the cookie will be available; the default value is `/`;

src/hooks.server.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,10 @@ export async function handleFetch({ event, request, fetch }) {
5858
2. https://kit.svelte.dev/docs/hooks#server-hooks-handlefetch
5959
*/
6060

61+
if (env.FRACTAL_SERVER_HOST.endsWith('/')) {
62+
env.FRACTAL_SERVER_HOST = env.FRACTAL_SERVER_HOST.substring(0, env.FRACTAL_SERVER_HOST.length - 1);
63+
}
64+
6165
if (request.url.startsWith(env.FRACTAL_SERVER_HOST)) {
6266
logger.trace('Including cookie into request to %s, via handleFetch', request.url);
6367
const cookie = event.request.headers.get('cookie');

0 commit comments

Comments
 (0)