I was surprised to find that I couldn't find any information on logging the request protocol in an nginx access log. I usually share a server block for both HTTP (80) and HTTPS (443) traffic, and use a combined access log for both. I'd like to indicate in each line in the access log if the request was over HTTP or HTTPS.
Is this possible, or do I need to use a separate server block for HTTPS and specify a separate access log for SSL?
It's a bit hidden in the docs, but you can use any of the common variables. This includes $scheme
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With