feat: remove end slash in request.host_url

This commit is contained in:
John Wang 2023-05-16 22:00:39 +08:00
parent f1925f0d82
commit dd557c1771
2 changed files with 8 additions and 4 deletions

View File

@ -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):

View File

@ -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.