mirror of
				https://github.com/deepset-ai/haystack.git
				synced 2025-10-31 09:49:48 +00:00 
			
		
		
		
	Add root_path option to REST API for reverse proxy deployments (#982)
This commit is contained in:
		
							parent
							
								
									4dd5a7a744
								
							
						
					
					
						commit
						0051a34ff9
					
				| @ -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.errors.http_error import http_error_handler | ||||||
| from rest_api.controller.router import router as api_router | 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") | logging.basicConfig(format="%(asctime)s %(message)s", datefmt="%m/%d/%Y %I:%M:%S %p") | ||||||
| logger = logging.getLogger(__name__) | logger = logging.getLogger(__name__) | ||||||
| @ -14,7 +15,7 @@ logging.getLogger("haystack").setLevel(logging.INFO) | |||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| def get_application() -> FastAPI: | 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 |     # This middleware enables allow all cross-domain requests to the API from a browser. For production | ||||||
|     # deployments, it could be made more restrictive. |     # deployments, it could be made more restrictive. | ||||||
|  | |||||||
| @ -7,3 +7,4 @@ INDEXING_PIPELINE_NAME = os.getenv("INDEXING_PIPELINE_NAME", "indexing") | |||||||
| FILE_UPLOAD_PATH = os.getenv("FILE_UPLOAD_PATH", "./file-upload") | FILE_UPLOAD_PATH = os.getenv("FILE_UPLOAD_PATH", "./file-upload") | ||||||
| 
 | 
 | ||||||
| LOG_LEVEL = os.getenv("LOG_LEVEL", "INFO") | LOG_LEVEL = os.getenv("LOG_LEVEL", "INFO") | ||||||
|  | ROOT_PATH = os.getenv("ROOT_PATH", "/") | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 Guillim
						Guillim