From 154522388323d52a622d3c9a28933bc91cf10147 Mon Sep 17 00:00:00 2001 From: Gabriel Almeida Date: Sat, 18 Mar 2023 14:19:58 -0300 Subject: [PATCH 1/8] 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 From 5f024dc52c5b5ad5da800301efef53fda7530302 Mon Sep 17 00:00:00 2001 From: Gabriel Almeida Date: Sat, 18 Mar 2023 17:54:57 -0300 Subject: [PATCH 2/8] fix: added logging --- src/backend/langflow/__main__.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/backend/langflow/__main__.py b/src/backend/langflow/__main__.py index 73f6106d6..cf2a2f8a0 100644 --- a/src/backend/langflow/__main__.py +++ b/src/backend/langflow/__main__.py @@ -7,6 +7,9 @@ from langflow.main import create_app import typer from fastapi.staticfiles import StaticFiles from pathlib import Path +import logging + +logger = logging.getLogger(__name__) def get_number_of_workers(workers=None): @@ -25,10 +28,11 @@ def replace_port(static_files_dir, host, port): # This is a hacky way to do it, but it works # 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}")' + logger.info(f"host: {host}") + logger.info(f"port: {port}") + url = f"{host}:{port}" if "http" in host else f"http://{host}:{port}" + logger.info(f"url: {url}") + new_string = f'setItem("port","{url}")' with open(static_files_dir / "index.html", "r") as f: index_html = f.read() From 7e08751bb152eef9c1e5c4088fc77d7c1132f3f7 Mon Sep 17 00:00:00 2001 From: Gabriel Almeida Date: Sat, 18 Mar 2023 18:22:51 -0300 Subject: [PATCH 3/8] fix: added tag to allow http --- src/frontend/public/index.html | 1 + 1 file changed, 1 insertion(+) diff --git a/src/frontend/public/index.html b/src/frontend/public/index.html index c1953d6b8..655da154e 100644 --- a/src/frontend/public/index.html +++ b/src/frontend/public/index.html @@ -4,6 +4,7 @@ + LangFLow