ghedo / http2-push-nginx-module

*DEPRECATED* NGINX now supports HTTP/2 server push out of the box http://hg.nginx.org/nginx/rev/641306096f5b
BSD 2-Clause "Simplified" License
40 stars 5 forks source link

More document about this module #9

Closed kevin25 closed 7 years ago

kevin25 commented 7 years ago

Hello, I'm really interested in this module. Do you have more detailed document? Thanks, Kevin

kevin25 commented 7 years ago

I'm trying to make it work with wordpress but there is no such option. It seems to work with static html only. Please give me advice. Thanks

ghedo commented 7 years ago

Hello, sorry for the delay.

The problem here is that the module doesn't parse Link headers from upstream, which is I think what Wordpress uses to generate pushes. This is because parsing those headers is tricky and doing it from C is particularly risky.

If you use openresty in your server you can parse those headers in Lua and generate pushes from there like in this example (I've been meaning to add some example code to do the parsing, but I have not had time to do it).

The alternative is to list all the pushes that Wordpress wants to do statically in the configuration file using multiple http2_push_path config directives.

kevin25 commented 7 years ago

Thanks for your response. Can you please make some sample with wordpress?

kevin25 commented 7 years ago

Which Openresty did you compile with? I tried to patch the latest version openresty-1.11.2.5 but failed.

root@server:/usr/local/src/openresty-1.11.2.5/bundle/nginx-1.11.2# patch -p01 < ../../../nginx-1.12.0/modules/http2-push-nginx-module/patches/nginx_1.11.12_http2_server_push.patch 
patching file src/http/v2/ngx_http_v2.c
Hunk #2 succeeded at 244 (offset -2 lines).
Hunk #3 succeeded at 1988 (offset -45 lines).
patching file src/http/v2/ngx_http_v2.h
Hunk #2 FAILED at 142.
1 out of 2 hunks FAILED -- saving rejects to file src/http/v2/ngx_http_v2.h.rej
kevin25 commented 7 years ago

Also compiled failed

make[1]: Leaving directory '/usr/local/src/openresty-1.11.2.5/build/nginx-1.11.2' Makefile:4: recipe for target 'all' failed make: *** [all] Error 2