1

I'm testing my HTTP/2 parser and currently I'm having trouble testing push promise with continuation. I'm using Apache as the HTTP/2 server. I managed to push a resource using either Location's Header add link or H2PushResource. But when I tried to check push promise with continuation I couldn't modify the headers sent in the pushed request.
I wanted to add a few long headers for the pushed request but the commands I found didn't affect the pushed request:

  • RequestHeader modifies the request headers before the content is handled - This means that the header is modified inside Apache's HTTP parser, it doesn't affect the sent pushed request
  • Header modifies the response headers sent from the server - This command adds a header to the response, not the request

Edit:
I noticed that the user-agent header is also sent in the pushed request, so I sent a really long user-agent header in my request but then I got a 431 response (Request header field too large).
Any other idea?

Edit 2: Here are my HTTP/2 configuration lines:

<Location /push.html>
    H2PushResource add "/push.png"
</Location>
Header set MyRespHeader "Testing response"
RequestHeader add MyReqHeader "Testing request"

When I receive a response from Apache I get the header myrespheader but the pushed request doesn't send the header myreqheader or myrespheader

EarthDragon
  • 755
  • 4
  • 14
  • What do you mean "don't affect the pushed request?" How do you know? Please explain clearly what you have attempted to do and why you believe it's not working. – Barry Pollard Jun 11 '17 at 23:34
  • I elaborated a bit. Is it clear now? – EarthDragon Jun 12 '17 at 04:17
  • No. Please show the config you have used and why you believe it's not working. It should be sent as a Response header and mod_http2 jumps in and also pushes the resource. Alternatively you can use H2PushResource rather than using headers. Either way you should use the 'as' option to ensure a pushed resource is used and not downloaded again. I've a blog post on it here: https://www.tunetheweb.com/performance/http2/http2-push/ – Barry Pollard Jun 12 '17 at 06:59
  • At the moment I don't know if you are struggling to get Push to work at all (as you seem confused whether to set on incoming or outgoing headers), or only with continuation frames. Or why you even think there is a problem with push on continuation frames. – Barry Pollard Jun 12 '17 at 07:07
  • I modified the question to answer some of the confusion. What do you mean the 'as' option? It couldn't find a reference to it in your blog post or Apache's mod_http2 documentation – EarthDragon Jun 12 '17 at 08:18
  • I see you are using H2PushResource rather than link headers so ignore my comments on 'as' option. Your code looks fine. What version of Apache are you using? And what browser and version? Also I do not understand why you expect the pushed resource to send the MyReqHeader - this is added to the request just before it is processed so Apache (or any downstream system if using Apache in front of it) will get this header - it does not mean it will be returned in the response. – Barry Pollard Jun 12 '17 at 22:06
  • The server is `Apache/2.4.25 (Unix)` and I'm using command line browser `nghttp2/1.17.0`. Why does it matter? The browser choice shouldn't affect the behavior of the server's pushes. I understand why myreqheader isn't shown, I tried to explain it in the original post. It was an example of a possible solution (that failed) for the problem (adding headers to the pushed request, so CONTINUATION frames will be added to PUSH_PROMISE frame) – EarthDragon Jun 13 '17 at 07:33
  • It matters because some browsers (e.g. Safari) don't support push. And neither does certain versions of nghttp (https://github.com/nghttp2/nghttp2/issues/21). This is why it is helpful to give as much detail as possible! Does push work in Chrome? That will help show if it's a client or server problem. – Barry Pollard Jun 13 '17 at 07:44
  • I don't have an issue with sending server push, this works fine. I'm having trouble adding headers to the pushed request. I want to add headers to the pushed request because this will allow me to inflate the pushed request to make Apache send a push request with a continuation frame – EarthDragon Jun 13 '17 at 11:47
  • OK now I finally understand the question you are asking. Can you clarify the last line though "When I receive a response from Apache I get the header myrespheader but the pushed request doesn't send the header myreqheader". Does the pushed request include myrespheader? If so doesn't that answer your question? – Barry Pollard Jun 13 '17 at 11:52
  • Let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/146530/discussion-between-earthdragon-and-bazzadp). – EarthDragon Jun 13 '17 at 12:21

0 Answers0