Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Blocked request. Host not allowed. #266

Closed
prudhvikrishnap opened this issue Feb 9, 2025 · 6 comments · Fixed by #271
Closed

[BUG] Blocked request. Host not allowed. #266

prudhvikrishnap opened this issue Feb 9, 2025 · 6 comments · Fixed by #271
Labels

Comments

@prudhvikrishnap
Copy link

Description:

Not able to access UI when self-hosting on k8s. This error is not occurring when using version 0.24.0 on k8s.

Docker Image Tag: ghcr.io/fmaclen/hollama:latest

Error:

Blocked request. This host ("{INGRESS_URL}") is not allowed.
To allow this host, add "{INGRESS_URL}"" to `preview.allowedHosts` in vite.config.js.

Reproduce Issue

  1. Create a kubernetes deployment with image tag: ghcr.io/fmaclen/hollama:latest
  2. Expose Application using service and ingress and try to access the URL with host mapping.
@shiqianwei0508
Copy link

change the file vite.config.ts

import { sveltekit } from '@sveltejs/kit/vite';
import { defineConfig } from 'vite';

export default defineConfig({
    plugins: [sveltekit()],
    preview: {
        allowedHosts: ['test.testdomain.com']
    }
});

@randomouscrap98
Copy link

randomouscrap98 commented Feb 20, 2025

While we certainly could change the container and rebuild, that kind of defeats half the purpose of using docker in the first place. It would be nice if perhaps this configuration was able to pull allowed hosts from environment variables. I was trying to self host on my server and ran into several problems, including this one.

@fmaclen
Copy link
Owner

fmaclen commented Feb 22, 2025

I'm not super familiar with Kubernetes but I just put out a new PR with an updated config to specify allowed hosts.

With these new changes you'd need to run the docker container as such:

docker run --rm -d -p 4173:4173 \
  -e VITE_ALLOWED_HOSTS='your-domain.com,another-domain.com' \
  --name hollama ghcr.io/fmaclen/hollama:latest

If VITE_ALLOWED_HOSTS is not specified, it will default to localhost.

@prudhvikrishnap Can you confirm if this will work with your setup?

@prudhvikrishnap
Copy link
Author

@fmaclen I built docker image and tested the code locally. By configuring the VITE_ALLOWED_HOSTS variable, I was able to access to the webpage when using a custom host. I also tested the scenario where the hosts variable was removed, which resulted in the error mentioned above.

The changes in the pull request were successful and worked as expected on my end.

@fmaclen
Copy link
Owner

fmaclen commented Feb 22, 2025

🎉 This issue has been resolved in version 0.27.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

@fmaclen
Copy link
Owner

fmaclen commented Feb 22, 2025

@prudhvikrishnap thanks for confirming the implementation. You should be able to pull the latest version of the image from the Docker hub.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants