f4lco / om-parser-stw-potsdam-v2

Connect canteens of the Studentenwerk Potsdam to OpenMensa
3 stars 7 forks source link

BASE_URL environment handling is not functional #4

Open kaifabian opened 6 years ago

kaifabian commented 6 years ago

Just tested the new code handling the BASE_URL parameter in production. Some problems occured:

kaifabian commented 6 years ago

I looked around and found wilbertom/flask-reverse-proxy, which is based on Flask snippet #35. I am not completely happy with their implementation -- not that they use non-standardized headers, but also they don't use the 'de-facto' standards X-Forwarded-For, X-Forwarded-Host and X-Forwarded-Proto.

Right now, I am thinking about forking that module and adapting it, so that it supports both the de-facto-standard X-Forwarded-For, X-Forwarded-Host, X-Forwarded-Proto, but also the standardized Forwarded header from RFC 7239, which supersedes those three.

For now, implementing this in om-parser-stw-potsdam-v2 is not urgent, since my current production environment config only 'fails' by generating 'http://' URLs, but these get redirected to 'https://' by my front-end load balancers whenever they are accessed. Since we are talking about public information published at these URLs, HTTPS is not strictly needed and the security implications of using HTTP are negligible.

f4lco commented 6 years ago

Whatever your operational requirements exactly are, feel free to implement & adapt. I encourage you to think in all directions, including swapping out Flask for another web (micro) framework. After all, it is very well feasible at this toy project size. It might be less effort than forking other modules in order to provide functionality to Flask which is supposedly missing - put in as much work as you want 😉