From 154522388323d52a622d3c9a28933bc91cf10147 Mon Sep 17 00:00:00 2001 From: Gabriel Almeida Date: Sat, 18 Mar 2023 14:19:58 -0300 Subject: [PATCH] fix: add the option to pass protocol in the host --- src/backend/langflow/__main__.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/backend/langflow/__main__.py b/src/backend/langflow/__main__.py index c93de7667..73f6106d6 100644 --- a/src/backend/langflow/__main__.py +++ b/src/backend/langflow/__main__.py @@ -23,7 +23,13 @@ def replace_port(static_files_dir, host, port): # we need to set the base url to the port that the server is running on # so that the frontend can make requests to the backend # This is a hacky way to do it, but it works - new_string = f'setItem("port","http://{host}:{port}")' + + # Check if the host is http or https + if "http" in host: + new_string = f'setItem("port","{host}:{port}")' + else: + new_string = f'setItem("port","http://{host}:{port}")' + with open(static_files_dir / "index.html", "r") as f: index_html = f.read() # using regex to replace the port