[PATCH] HTTP/2: copy additional headers in the pushed requests
Ruslan Ermilov
ru at nginx.com
Thu Feb 8 19:28:34 UTC 2018
On Thu, Feb 08, 2018 at 05:07:49PM +0000, Alessandro Ghedini wrote:
> On Thu, Feb 08, 2018 at 05:04:58PM +0000, Alessandro Ghedini wrote:
> > # HG changeset patch
> > # User Alessandro Ghedini <alessandro at cloudflare.com>
> > # Date 1518109032 0
> > # Thu Feb 08 16:57:12 2018 +0000
> > # Branch push-copy-headers
> > # Node ID 4f7f42e6d13add2ab0c7a9654472bb74085181d1
> > # Parent a49af443656f2b65ca5de9d8cad5594f44e18ff7
> > HTTP/2: copy additional headers in the pushed requests.
> >
> > To ensure pushed requests are processed consistently with the original
> > client request, some headers need to be copied from the original request
> > into the pushed one.
> >
> > The headers currently copied are User-Agent, Accept, Accept-Language and
> > Accept-Encoding.
>
> So, I'm not quite sure if this is the correct way to go about doing this, but
> I think the issue is real and worth fixing, so I'd be happy to implement this
> differently if you have alternative ideas.
I don't think this is a good idea. Copying Accept is definitely
a bad idea. If this is at all needed, this should be implemented
as an "http2_push_header <header> <value>" directive, but then it
could not be made dependent on the pushed resource.
For example, a simple HTML with "img src" results in the following
Accept values for HTML, and then for image (Chrome and Firefox):
http request line: "GET / HTTP/1.1"
http header: "Host: 127.0.0.1:8000"
http header: "Connection: keep-alive"
http header: "Cache-Control: max-age=0"
http header: "Upgrade-Insecure-Requests: 1"
http header: "User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/64.0.3282.140 Safari/537.36"
http header: "Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8"
http header: "Accept-Encoding: gzip, deflate, br"
http header: "Accept-Language: ru,en-US;q=0.9,en;q=0.8,zh-TW;q=0.7,zh;q=0.6"
http request line: "GET /foo.jpg HTTP/1.1"
http header: "Host: 127.0.0.1:8000"
http header: "Connection: keep-alive"
http header: "User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/64.0.3282.140 Safari/537.36"
http header: "Accept: image/webp,image/apng,image/*,*/*;q=0.8"
http header: "Referer: http://127.0.0.1:8000/"
http header: "Accept-Encoding: gzip, deflate, br"
http header: "Accept-Language: ru,en-US;q=0.9,en;q=0.8,zh-TW;q=0.7,zh;q=0.6"
http request line: "GET / HTTP/1.1"
http header: "Host: 127.0.0.1:8000"
http header: "User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.13; rv:52.0) Gecko/20100101 Firefox/52.0"
http header: "Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"
http header: "Accept-Language: ru-RU,ru;q=0.8,en-US;q=0.5,en;q=0.3"
http header: "Accept-Encoding: gzip, deflate"
http header: "Connection: keep-alive"
http header: "Upgrade-Insecure-Requests: 1"
http request line: "GET /foo.jpg HTTP/1.1"
http header: "Host: 127.0.0.1:8000"
http header: "User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.13; rv:52.0) Gecko/20100101 Firefox/52.0"
http header: "Accept: */*"
http header: "Accept-Language: ru-RU,ru;q=0.8,en-US;q=0.5,en;q=0.3"
http header: "Accept-Encoding: gzip, deflate"
http header: "Referer: http://127.0.0.1:8000/"
http header: "Connection: keep-alive"
More information about the nginx-devel
mailing list