1

I'm experimenting with pushing redirects using nginxs http2_push_preload on; directive.

In my application I detect redirects and add a Link: <location>; as=document; rel=preload header that matches the Location header.

This works well for some redirects, but fails for redirects where the resulting page depends on the value of a cookie (e.g. a cookie containing a session identifier).

While debugging I noticed that the "preload" request is missing the cookies that are available in the originating requests.

In fact only a subset of the original headers are sent in the "preload" request (Accept-* and User-Agent), headers like Cookie and Referer are missing.

How can I make nginx forward all headers of the original request to the preload request? Or is this not possible?

jaap3
  • 121
  • 3

1 Answers1

1

It turns out that this is currently not possible, and likely will never be possible.

I found a similar request in nginx's issue tracker about the forwarding of the Authorization header https://trac.nginx.org/nginx/ticket/1817, which is closed with a WONTFIX resolution.

Another ticket, mentioning the Vary header was closed as a DUPLICATE https://trac.nginx.org/nginx/ticket/1851

I created another ticket requesting the addition of the Cookie header, just to make sure https://trac.nginx.org/nginx/ticket/1935

jaap3
  • 121
  • 3
  • Did you manage to solve this issue with other means? I did setup http2 push on nginx and it works as expected. Unless I enable cookie based authentication - since cookies are not passed on to pushed requests, all subsequent pushes fails with 401, as they should. So basically, in my use case (API calls, pushing subresources) HTTP2 push is useless, because I use cookies. – Andis Feb 11 '22 at 13:46