By odahcam
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?
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
I did a test and found the following headers to be set by the proxy (IPs faked) for my HTTPS endpoint:
x-forwarded-for: 123.123.123.123,100.101.102.103
x-forwarded-proto: https
cdn-loop: cloudflare
do-connecting-ip: 123.123.123.123
Note that the headers are sent lower-case.
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.