Add root_path option to REST API for reverse proxy deployments (#982)

This commit is contained in:
Guillim 2021-04-20 11:19:28 +02:00 committed by GitHub
parent 4dd5a7a744
commit 0051a34ff9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 1 deletions

View File

@ -6,6 +6,7 @@ from starlette.middleware.cors import CORSMiddleware
from rest_api.controller.errors.http_error import http_error_handler
from rest_api.controller.router import router as api_router
from rest_api.config import ROOT_PATH
logging.basicConfig(format="%(asctime)s %(message)s", datefmt="%m/%d/%Y %I:%M:%S %p")
logger = logging.getLogger(__name__)
@ -14,7 +15,7 @@ logging.getLogger("haystack").setLevel(logging.INFO)
def get_application() -> FastAPI:
application = FastAPI(title="Haystack-API", debug=True, version="0.1")
application = FastAPI(title="Haystack-API", debug=True, version="0.1", root_path=ROOT_PATH)
# This middleware enables allow all cross-domain requests to the API from a browser. For production
# deployments, it could be made more restrictive.

View File

@ -7,3 +7,4 @@ INDEXING_PIPELINE_NAME = os.getenv("INDEXING_PIPELINE_NAME", "indexing")
FILE_UPLOAD_PATH = os.getenv("FILE_UPLOAD_PATH", "./file-upload")
LOG_LEVEL = os.getenv("LOG_LEVEL", "INFO")
ROOT_PATH = os.getenv("ROOT_PATH", "/")