monarch-initiative / biolink-api

API for linked biological knowledge
https://api.monarchinitiative.org/api/
BSD 3-Clause "New" or "Revised" License
63 stars 25 forks source link

Added ProxyFix wrapper to detect protocol from proxy #377

Closed falquaddoomi closed 3 years ago

falquaddoomi commented 3 years ago

Basically, this allows biolink to correctly construct self-URLs when being served from behind an SSL-terminating proxy (e.g., how it's running behind the GCP load balancer). Without the fix, biolink will assume it's running on HTTP and construct self-URLs with that protocol. Specifically, it looks for a set of headers that your proxy should pass when hitting biolink; more details here: https://werkzeug.palletsprojects.com/en/2.0.x/middleware/proxy_fix/#werkzeug.middleware.proxy_fix.ProxyFix.

Other changes: removed unused imports, reformatted according to PEP8.