-
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
Fix/forwarding headers #415
Fix/forwarding headers #415
Conversation
Looks great. I will give this fix a try.. One thing I noted.. base_url is used in a few times in |
@gnosys-ccoupal yes, I didn't see that, and it complicates things. Currently I have an implementation in both the pgstac and sqlalchemy application, but Perhaps the better solution is to introduce a middleware in |
Converted to Draft PR while working on a suitable middleware approach. |
No longer draft status - ready to review with new middleware approach that covers all response links |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This LGTM! Thanks for writing solid tests. Because this feature is talked about a lot I'm going to write some unittests covering the middleware itself and then get this merged.
Related Issue(s):
Description:
Support Forwarded and X-Forwarded-* headers so that stac-fastapi responses contain links that accommodate load balancer or proxy configurations.
Note: there is duplication of both code and concepts across the pgstac and sqlalchemy applications. Each application has its own method of generating links (I don't know why this logic wasn't shared) and therefore each has a copy of the get_base_url_from_request function here. This explains why this PR has duplicate code and does not follow a more sensible DRY strategy - the repo really isn't set up for it and I am not looking to make large-scale refactoring changes here.
PR Checklist:
pre-commit run --all-files
)make test
)make docs
)