diff src/http/v2/ngx_http_v2.c @ 7296:8e6bb4e6045f

HTTP/2: use scheme from original request for pushes (closes #1549). Instead of the connection scheme, use scheme from the original request. This fixes pushes when SSL is terminated by a proxy server in front of nginx.
author Ruslan Ermilov <ru@nginx.com>
date Thu, 07 Jun 2018 20:04:22 +0300
parents 89430899c72a
children fbb683496705
line wrap: on
line diff
--- a/src/http/v2/ngx_http_v2.c
+++ b/src/http/v2/ngx_http_v2.c
@@ -2616,15 +2616,12 @@ ngx_http_v2_push_stream(ngx_http_v2_stre
     r->method_name = ngx_http_core_get_method;
     r->method = NGX_HTTP_GET;
 
-#if (NGX_HTTP_SSL)
-    if (fc->ssl) {
-        ngx_str_set(&r->schema, "https");
-
-    } else
-#endif
-    {
-        ngx_str_set(&r->schema, "http");
-    }
+    r->schema.data = ngx_pstrdup(pool, &parent->request->schema);
+    if (r->schema.data == NULL) {
+        goto close;
+    }
+
+    r->schema.len = parent->request->schema.len;
 
     value.data = ngx_pstrdup(pool, path);
     if (value.data == NULL) {