mirror of
https://github.com/khoaliber/khoj.git
synced 2026-03-08 05:39:13 +00:00
Use KHOJ_DOMAIN for CORS allow_origins list as well
- Default to app.khoj.dev - Remove unnecesary any_path regex in allow_origins. It only cares about host, paths are not set in origin header
This commit is contained in:
@@ -51,9 +51,16 @@ app = FastAPI()
|
|||||||
django_app = get_asgi_application()
|
django_app = get_asgi_application()
|
||||||
|
|
||||||
# Add CORS middleware
|
# Add CORS middleware
|
||||||
|
KHOJ_DOMAIN = os.getenv("KHOJ_DOMAIN", "app.khoj.dev")
|
||||||
app.add_middleware(
|
app.add_middleware(
|
||||||
CORSMiddleware,
|
CORSMiddleware,
|
||||||
allow_origins=["app://obsidian.md", "http://localhost:*", "https://app.khoj.dev/*", "app://khoj.dev"],
|
allow_origins=[
|
||||||
|
"app://obsidian.md",
|
||||||
|
"http://localhost:*",
|
||||||
|
"http://127.0.0.1:*",
|
||||||
|
f"https://{KHOJ_DOMAIN}",
|
||||||
|
"app://khoj.dev",
|
||||||
|
],
|
||||||
allow_credentials=True,
|
allow_credentials=True,
|
||||||
allow_methods=["*"],
|
allow_methods=["*"],
|
||||||
allow_headers=["*"],
|
allow_headers=["*"],
|
||||||
|
|||||||
Reference in New Issue
Block a user