barcodebuddy-docker icon indicating copy to clipboard operation
barcodebuddy-docker copied to clipboard

Add support for X-Forwarded-Proto header

Open daften opened this issue 4 years ago • 3 comments

By default nginx doesn't use the X-Forwarded-Proto header to set the HTTPS entry in the S_SERVER global array. By updating the default nginx file, that could be remedied. For apache SetEnvIf can be used in a htaccess file, for nginx, no idea what the best approach is tbh.

daften avatar Aug 25 '21 23:08 daften

I get that error from https://github.com/Forceu/barcodebuddy-android/issues/4, because the redirect isn't followed in the app it seems. But if the URL generated from the BCB UI would be correct, it would be fine too :)

daften avatar Aug 25 '21 23:08 daften

Is this related to the Docker nginx configuration or the Barcode Buddy example file? Because it is already set in https://github.com/Forceu/barcodebuddy/blob/2ca740956d3072baa2bc1767caf61e32285a4fd0/example/nginxReverseProxy.conf#L22

Forceu avatar Aug 28 '21 12:08 Forceu

It's related to the docker nginx configuration. If you look at the URL on the "add mobile app" page, you see that it uses http if behind a reverse proxy that uses X-Forwarded-Proto, because nowhere is the HTTPS env variable set to on. I know how to do that in a htaccess file, not for nginx (which is used in the docker container) unfortunately. But I'm guessing it must be possible. The URL can be changed manually, but it's easy to look over this and I think many people will make a mistake against this and run into a wall :)

daften avatar Aug 28 '21 14:08 daften