How to log http vs. https?

I would like to add information to my log to tell me whether a request
was received and handled over http or if it was over https (I have nginx
set up to handle ssl and non-ssl for the same server/ip/host).

Right now I am logging $request which is just the relative portion of
the URL ("/path/to/file.htm"). I assume I could change this to
$request_uri and it would log the full uri including the http:// or
https:// part. However that will add unnecessary size to my files.

So instead I was wondering if there was a variable like $port I could
log so I can see whether the answer is 80 vs. 443 which would tell me
what I want to know in the logs. Is this possible? Thanks!

On Wed, May 21, 2008 at 08:02:22AM -0700, Rt Ibmer wrote:

I would like to add information to my log to tell me whether a request was received and handled over http or if it was over https (I have nginx set up to handle ssl and non-ssl for the same server/ip/host).

Right now I am logging $request which is just the relative portion of the URL ("/path/to/file.htm"). I assume I could change this to $request_uri and it would log the full uri including the http:// or https:// part. However that will add unnecessary size to my files.

So instead I was wondering if there was a variable like $port I could log so I can see whether the answer is 80 vs. 443 which would tell me what I want to know in the logs. Is this possible? Thanks!

$server_port - 80/443
$scheme - http/https

On Wednesday 21 May 2008, Rt Ibmer wrote:

so I can see whether the answer is 80 vs. 443 which would tell me what I
want to know in the logs. Is this possible? Thanks!

$scheme or $server_port

http://wiki.codemongers.com/NginxHttpCoreModule#var_scheme
http://wiki.codemongers.com/NginxHttpCoreModule#var_server_port

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs