khoj-ai / khoj

Your AI second brain. Get answers to your questions, whether they be online or in your own notes. Use online AI models (e.g gpt4) or private, local LLMs (e.g llama3). Self-host locally or use our cloud instance. Access from Obsidian, Emacs, Desktop app, Web or Whatsapp.
https://khoj.dev
GNU Affero General Public License v3.0
11.95k stars 595 forks source link

[FIX] Bad Request (400) running in docker #745

Open techieanant opened 1 month ago

techieanant commented 1 month ago

Describe the bug

I'm running Khoj docker compose stack on a server on my local network, have all the env variables setup but visiting /server/admin route throws a 400 Bad Request error. The logs show the following error:

 DisallowedHost: Invalid HTTP_HOST                    

 header: '10.0.0.197:42110'. You may                  

 need to add '10.0.0.197' to                          

 ALLOWED_HOSTS.

There seems to be no way to add a environment variable for setting allowed hosts.

To Reproduce

Steps to reproduce the behavior:

Screenshots

image

Platform

If self-hosted

Additional context

Add any other context about the problem here.

sabaimran commented 1 month ago

Hey @techieanant , I'm assuming you can't access it over localhost?

You must have used the docker-compose.yml sample file to scaffold you Khoj instance. You can use that to set the environment variable KHOJ_DOMAIN. There are some notes about that here: https://docs.khoj.dev/get-started/setup/#setup-notes.

techieanant commented 1 month ago

Thank you that worked although I now see a different problem.

image