Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Logging the request protocol in nginx?

Tags:

nginx

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?

like image 542
Brian Avatar asked Apr 30 '13 17:04

Brian


1 Answers

It's a bit hidden in the docs, but you can use any of the common variables. This includes $scheme.

like image 88
2 revs, 2 users 67%user1600649 Avatar answered Sep 29 '22 20:09

2 revs, 2 users 67%user1600649