|
@ -1052,12 +1052,12 @@ class FastAPI(Starlette): |
|
|
if self.root_path: |
|
|
if self.root_path: |
|
|
root_path = scope.get("root_path", "") |
|
|
root_path = scope.get("root_path", "") |
|
|
if root_path and self.root_path != root_path: |
|
|
if root_path and self.root_path != root_path: |
|
|
raise RuntimeError( |
|
|
logger.warning( |
|
|
f"The ASGI server is using a different root path than the one " |
|
|
f"The ASGI server is using a different root path than the one " |
|
|
f"configured in FastAPI. The configured root path is: " |
|
|
f"configured in FastAPI. The configured root path is: " |
|
|
f"{self.root_path}, the ASGI server root path is: {root_path}. " |
|
|
f"{self.root_path}, the ASGI server root path is: {root_path}. " |
|
|
|
|
|
f"The former will be used." |
|
|
) |
|
|
) |
|
|
else: |
|
|
|
|
|
scope["root_path"] = self.root_path |
|
|
scope["root_path"] = self.root_path |
|
|
path = scope.get("path") |
|
|
path = scope.get("path") |
|
|
if path and not path.startswith(self.root_path): |
|
|
if path and not path.startswith(self.root_path): |
|
|