mirror of
https://github.com/mealie-recipes/mealie.git
synced 2026-02-05 07:23:12 -05:00
fix: use BASE_URL config for redirect_url if available (#6995)
Co-authored-by: Michael Genson <genson.michael@gmail.com>
This commit is contained in:
@@ -110,6 +110,11 @@ class AppSettings(AppLoggingSettings):
|
|||||||
BASE_URL: str = "http://localhost:8080"
|
BASE_URL: str = "http://localhost:8080"
|
||||||
"""trailing slashes are trimmed (ex. `http://localhost:8080/` becomes ``http://localhost:8080`)"""
|
"""trailing slashes are trimmed (ex. `http://localhost:8080/` becomes ``http://localhost:8080`)"""
|
||||||
|
|
||||||
|
@property
|
||||||
|
def is_default_base_url(self) -> bool:
|
||||||
|
"""Returns True if BASE_URL has not been changed from the default."""
|
||||||
|
return self.BASE_URL == "http://localhost:8080"
|
||||||
|
|
||||||
STATIC_FILES: str = str(PACKAGE_DIR / "frontend")
|
STATIC_FILES: str = str(PACKAGE_DIR / "frontend")
|
||||||
"""path to static files directory (ex. `mealie/dist`)"""
|
"""path to static files directory (ex. `mealie/dist`)"""
|
||||||
|
|
||||||
|
|||||||
@@ -99,7 +99,12 @@ async def oauth_login(request: Request):
|
|||||||
# in development, we want to redirect to the frontend
|
# in development, we want to redirect to the frontend
|
||||||
redirect_url = "http://localhost:3000/login"
|
redirect_url = "http://localhost:3000/login"
|
||||||
else:
|
else:
|
||||||
redirect_url = URLPath("/login").make_absolute_url(request.base_url)
|
# Prioritize User Configuration over Request Headers.
|
||||||
|
if not settings.is_default_base_url:
|
||||||
|
base = settings.BASE_URL or request.base_url
|
||||||
|
else:
|
||||||
|
base = request.base_url
|
||||||
|
redirect_url = URLPath("/login").make_absolute_url(base)
|
||||||
|
|
||||||
response: RedirectResponse = await client.authorize_redirect(request, redirect_url)
|
response: RedirectResponse = await client.authorize_redirect(request, redirect_url)
|
||||||
return response
|
return response
|
||||||
|
|||||||
@@ -27,6 +27,7 @@ services:
|
|||||||
network_mode: host
|
network_mode: host
|
||||||
environment:
|
environment:
|
||||||
ALLOW_SIGNUP: True
|
ALLOW_SIGNUP: True
|
||||||
|
BASE_URL: http://localhost:9000
|
||||||
DB_ENGINE: sqlite
|
DB_ENGINE: sqlite
|
||||||
|
|
||||||
OIDC_AUTH_ENABLED: True
|
OIDC_AUTH_ENABLED: True
|
||||||
|
|||||||
Reference in New Issue
Block a user