[PATCH] SPDY: set $scheme from scheme request header

Ragnar Rova ragnar.rova at gmail.com
Wed Jan 29 22:06:40 UTC 2014


# HG changeset patch
# User Ragnar Rova <ragnar.rova at gmail.com>
# Date 1391033075 -3600
#      Wed Jan 29 23:04:35 2014 +0100
# Node ID 6654eae26c8b2a718e5ad116650faf37f7be7aa9
# Parent  01e2a5bcdd8f65f4f7bcb23ac35911da08e5945f
SPDY: set $scheme from scheme request header.

$scheme variable is always "https" when using spdy, existing code
just sets scheme to https based on if we are on a ssl connection.
In spdy, there is a scheme header which should be used. Chrome uses
http:// urls when establishing connections to sites using the
Alternate-Protocol header. If you want some locations to be visible
to the user as https, you can use $scheme in a http to https
redirect rule.

diff -r 01e2a5bcdd8f -r 6654eae26c8b src/http/ngx_http_variables.c
--- a/src/http/ngx_http_variables.c	Tue Jan 28 15:33:49 2014 -0800
+++ b/src/http/ngx_http_variables.c	Wed Jan 29 23:04:35 2014 +0100
@@ -1306,6 +1306,18 @@
     }
 
 #endif
+#if (NGX_HTTP_SPDY)
+
+    if (r->spdy_stream) {
+        v->valid = 1;
+        v->no_cacheable = 0;
+        v->not_found = 0;
+        v->len = r->schema_end-r->schema_start;
+        v->data = r->schema_start;
+        return NGX_OK;
+    }
+
+#endif
 
     v->len = sizeof("http") - 1;
     v->valid = 1;



More information about the nginx-devel mailing list