From dd557c17718236245a97d54cf98557bb50474e6b Mon Sep 17 00:00:00 2001 From: John Wang Date: Tue, 16 May 2023 22:00:39 +0800 Subject: [PATCH] feat: remove end slash in request.host_url --- api/models/model.py | 4 ++-- docker/docker-compose.yaml | 8 ++++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/api/models/model.py b/api/models/model.py index 6ff8a31fc1..6ddbd858e1 100644 --- a/api/models/model.py +++ b/api/models/model.py @@ -56,7 +56,7 @@ class App(db.Model): @property def api_base_url(self): - return (current_app.config['API_URL'] if current_app.config['API_URL'] else request.host_url) + '/v1' + return (current_app.config['API_URL'] if current_app.config['API_URL'] else request.host_url.rstrip('/')) + '/v1' @property def tenant(self): @@ -505,7 +505,7 @@ class Site(db.Model): @property def app_base_url(self): - return (current_app.config['APP_URL'] if current_app.config['APP_URL'] else request.host_url) + '/v1' + return (current_app.config['APP_URL'] if current_app.config['APP_URL'] else request.host_url.rstrip('/')) + '/v1' class ApiToken(db.Model): diff --git a/docker/docker-compose.yaml b/docker/docker-compose.yaml index 26f5797ef7..a337377cfa 100644 --- a/docker/docker-compose.yaml +++ b/docker/docker-compose.yaml @@ -154,9 +154,13 @@ services: restart: always environment: EDITION: SELF_HOSTED - # The base URL of console application, refers to the Console base URL of WEB service. + # The base URL of console application, refers to the Console base URL of WEB service if console domain is + # different from api or web app domain. + # example: http://cloud.dify.ai CONSOLE_URL: '' - # The URL for Web APP, refers to the Web App base URL of WEB service. + # The URL for Web APP, refers to the Web App base URL of WEB service if web app domain is different from + # console or api domain. + # example: http://udify.app APP_URL: '' # The postgres database.