Spaces:
Running
Running
Add `ALLOW_INSECURE_COOKIES` feature flag (#1076)
Browse files- .env +1 -0
- README.md +11 -2
- src/lib/server/auth.ts +2 -1
- src/routes/logout/+page.server.ts +2 -2
.env
CHANGED
@@ -153,3 +153,4 @@ WEBHOOK_URL_REPORT_ASSISTANT=#provide webhook url to get notified when an assist
|
|
153 |
ALLOWED_USER_EMAILS=`[]` # if it's defined, only these emails will be allowed to use the app
|
154 |
|
155 |
USAGE_LIMITS=`{}`
|
|
|
|
153 |
ALLOWED_USER_EMAILS=`[]` # if it's defined, only these emails will be allowed to use the app
|
154 |
|
155 |
USAGE_LIMITS=`{}`
|
156 |
+
ALLOW_INSECURE_COOKIES=false # recommended to keep this to false but set to true if you need to run over http without tls
|
README.md
CHANGED
@@ -24,8 +24,9 @@ A chat interface using open source models, eg OpenAssistant or Llama. It is a Sv
|
|
24 |
3. [Web Search](#web-search)
|
25 |
4. [Text Embedding Models](#text-embedding-models)
|
26 |
5. [Extra parameters](#extra-parameters)
|
27 |
-
6. [
|
28 |
-
7. [
|
|
|
29 |
|
30 |
## No Setup Deploy
|
31 |
|
@@ -735,6 +736,14 @@ MODELS=`[
|
|
735 |
]`
|
736 |
```
|
737 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
738 |
## Deploying to a HF Space
|
739 |
|
740 |
Create a `DOTENV_LOCAL` secret to your HF space with the content of your .env.local, and they will be picked up automatically when you run.
|
|
|
24 |
3. [Web Search](#web-search)
|
25 |
4. [Text Embedding Models](#text-embedding-models)
|
26 |
5. [Extra parameters](#extra-parameters)
|
27 |
+
6. [Common issues](#common-issues)
|
28 |
+
7. [Deploying to a HF Space](#deploying-to-a-hf-space)
|
29 |
+
8. [Building](#building)
|
30 |
|
31 |
## No Setup Deploy
|
32 |
|
|
|
736 |
]`
|
737 |
```
|
738 |
|
739 |
+
## Common issues
|
740 |
+
|
741 |
+
### 403:You don't have access to this conversation
|
742 |
+
|
743 |
+
Most likely you are running chat-ui over HTTP. The recommended option is to setup something like NGINX to handle HTTPS and proxy the requests to chat-ui. If you really need to run over HTTP you can add `ALLOW_INSECURE_COOKIES=true` to your `.env.local`.
|
744 |
+
|
745 |
+
Make sure to set your `PUBLIC_ORIGIN` in your `.env.local` to the correct URL as well.
|
746 |
+
|
747 |
## Deploying to a HF Space
|
748 |
|
749 |
Create a `DOTENV_LOCAL` secret to your HF space with the content of your .env.local, and they will be picked up automatically when you run.
|
src/lib/server/auth.ts
CHANGED
@@ -10,6 +10,7 @@ import {
|
|
10 |
OPENID_TOLERANCE,
|
11 |
OPENID_RESOURCE,
|
12 |
OPENID_CONFIG,
|
|
|
13 |
} from "$env/static/private";
|
14 |
import { sha256 } from "$lib/utils/sha256";
|
15 |
import { z } from "zod";
|
@@ -55,7 +56,7 @@ export function refreshSessionCookie(cookies: Cookies, sessionId: string) {
|
|
55 |
path: "/",
|
56 |
// So that it works inside the space's iframe
|
57 |
sameSite: dev ? "lax" : "none",
|
58 |
-
secure: !dev,
|
59 |
httpOnly: true,
|
60 |
expires: addWeeks(new Date(), 2),
|
61 |
});
|
|
|
10 |
OPENID_TOLERANCE,
|
11 |
OPENID_RESOURCE,
|
12 |
OPENID_CONFIG,
|
13 |
+
ALLOW_INSECURE_COOKIES,
|
14 |
} from "$env/static/private";
|
15 |
import { sha256 } from "$lib/utils/sha256";
|
16 |
import { z } from "zod";
|
|
|
56 |
path: "/",
|
57 |
// So that it works inside the space's iframe
|
58 |
sameSite: dev ? "lax" : "none",
|
59 |
+
secure: !dev && !(ALLOW_INSECURE_COOKIES === "true"),
|
60 |
httpOnly: true,
|
61 |
expires: addWeeks(new Date(), 2),
|
62 |
});
|
src/routes/logout/+page.server.ts
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
import { dev } from "$app/environment";
|
2 |
import { base } from "$app/paths";
|
3 |
-
import { COOKIE_NAME } from "$env/static/private";
|
4 |
import { collections } from "$lib/server/database";
|
5 |
import { redirect } from "@sveltejs/kit";
|
6 |
|
@@ -12,7 +12,7 @@ export const actions = {
|
|
12 |
path: "/",
|
13 |
// So that it works inside the space's iframe
|
14 |
sameSite: dev ? "lax" : "none",
|
15 |
-
secure: !dev,
|
16 |
httpOnly: true,
|
17 |
});
|
18 |
throw redirect(303, `${base}/`);
|
|
|
1 |
import { dev } from "$app/environment";
|
2 |
import { base } from "$app/paths";
|
3 |
+
import { COOKIE_NAME, ALLOW_INSECURE_COOKIES } from "$env/static/private";
|
4 |
import { collections } from "$lib/server/database";
|
5 |
import { redirect } from "@sveltejs/kit";
|
6 |
|
|
|
12 |
path: "/",
|
13 |
// So that it works inside the space's iframe
|
14 |
sameSite: dev ? "lax" : "none",
|
15 |
+
secure: !dev && !(ALLOW_INSECURE_COOKIES === "true"),
|
16 |
httpOnly: true,
|
17 |
});
|
18 |
throw redirect(303, `${base}/`);
|