App Platform reverse proxies the requests to the Components but always to the same port, making it impossible to differ the request’s protocol used by just checking whether was the port 443 or 80 that received the request.
For exemple, NGINX allows us to use the Forwarded
header to carry that information through a proxy thus letting or application check the protocol originally used to make the request.
Others also work with the X-Forwarded-Proto
header with some other headers to carry that information through a proxy, but this one doesn’t seem to work.
That said, how could I check via PHP inside my component (running NGINX + PHP-FPM) which was the protocol originally used to make the request?
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.
Click below to sign up and get $100 of credit to try our products over 60 days!
I did a test and found the following headers to be set by the proxy (IPs faked) for my HTTPS endpoint:
Note that the headers are sent lower-case.