Skip to content

Commit 84d365b

Browse files
authored
feat: allow requests from specified hosts (#271)
Closes #266
1 parent e18b6f3 commit 84d365b

File tree

3 files changed

+23
-1
lines changed

3 files changed

+23
-1
lines changed

Dockerfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ RUN addgroup -S appgroup && adduser -S appuser -G appgroup
66
WORKDIR /app
77

88
ENV PUBLIC_ADAPTER='docker-node'
9+
ENV VITE_ALLOWED_HOSTS='localhost'
910

1011
COPY . .
1112

SELF_HOSTING.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
- [Getting started](#getting-started)
44
- [Updating to the latest version](#updating-to-the-latest-version)
55
- [Connecting to an Ollama server hosted elsewhere](#connecting-to-an-ollama-server-hosted-elsewhere)
6+
- [Configuring allowed hosts](#configuring-allowed-hosts)
67

78
## Getting started
89

@@ -41,3 +42,15 @@ If you are using the publicly hosted version or your Docker server is on a separ
4142
```bash
4243
OLLAMA_ORIGINS=https://hollama.fernando.is ollama serve
4344
```
45+
46+
## Configuring allowed hosts
47+
48+
When hosting Hollama behind a reverse proxy or in a Kubernetes environment, you'll need to specify which domains are allowed to access the application. Use the `VITE_ALLOWED_HOSTS` environment variable to set this:
49+
50+
```shell
51+
docker run --rm -d -p 4173:4173 \
52+
-e VITE_ALLOWED_HOSTS='your-domain.com,another-domain.com' \
53+
--name hollama ghcr.io/fmaclen/hollama:latest
54+
```
55+
56+
Multiple domains can be specified by separating them with commas. If not specified, only 'localhost' will be allowed.

vite.config.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,13 @@ import { sveltekit } from '@sveltejs/kit/vite';
22
import { defineConfig } from 'vite';
33

44
export default defineConfig({
5-
plugins: [sveltekit()]
5+
plugins: [sveltekit()],
6+
preview: {
7+
// Allow all hosts in preview mode
8+
host: true,
9+
// Use environment variable for allowed hosts, falling back to localhost
10+
allowedHosts: process.env.VITE_ALLOWED_HOSTS
11+
? process.env.VITE_ALLOWED_HOSTS.split(',')
12+
: ['localhost']
13+
}
614
});

0 commit comments

Comments
 (0)