-
Notifications
You must be signed in to change notification settings - Fork 105
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base_url used to build the urls without root_path #767
Comments
Hi @ccancellieri, I'm not sure to fully get everything. We've had numerous report related to Could you be a bit more precise how you are
This is a legacy code and I will be worry to change this logic for now |
This is what I'm trying to obtain: ... and here is why:
Thank you for this! |
Could you just use the |
Unfortunately Collections uses the base_url to calculate the links:
and router_prefix is not affecting this. I think the unique option to correctly mount as a catalog this application is to use root_path or request.url to build the links to make it working behind a mounted context. Current code: Result (wrong): 'http://localhost:8080/collections/1e8874ad-d2b1-4eba-a881-7c8f092adffd' Working but clunky: Result (correct): Working and flexible: Result (correct): thanks again. I could try to produce a fix and a POC if it coud help. |
Hi all,
I need to have multiple instances of this api under the same fastAPI and I'm trying to understand why base_url has been used to generate urls not using also:
f"{base_url}/{request.scope.get("root_path")}
This is preventing me to mount the application under a specific fastAPI path: all the generated urls are not shipping the root_path infact.
It works with a fixed prefix but it is kind of hardcoded routing base url which prevents me to properly use fastAPI with this library.
It would be great if we could centralise the base url management here to also use the root_path from the scope:
def get_base_url(request: Request) -> str:
My goal is to mount multiple times this library to be able to have a first level of catalogs in a single application:
Related problem:
stac-utils/stac-fastapi-elasticsearch-opensearch#308 (comment)
Related questions: why we are using the state of the application to save it?
app.state.router_prefix=....
What do you think?
The text was updated successfully, but these errors were encountered: