Nginx-extra or with headers-more-nginx-module

Hi, everybody,
Has anyone tried to compile nginx-extra package (like available on Debian) or nginx with headers-more module? It would be useful.

OK, I'll asnwer myself :grin:

--- ./feeds/packages/net/nginx/Makefile    2017-06-17 16:53:01.358481000 +0200
+++ ./feeds/packages/net/nginx/Makefile    2017-06-17 18:33:35.254244248 +0200
@@ -61,7 +61,8 @@
     CONFIG_NGINX_NAXSI \
     CONFIG_NGINX_LUA \
     CONFIG_NGINX_HTTP_REAL_IP \
-    CONFIG_NGINX_HTTP_SECURE_LINK
+    CONFIG_NGINX_HTTP_SECURE_LINK \
+    CONFIG_NGINX_HEADERS_MORE
 
 include $(INCLUDE_DIR)/package.mk
 
@@ -91,6 +92,9 @@
 endef
 
 ADDITIONAL_MODULES:=
+ifeq ($(CONFIG_NGINX_HEADERS_MORE),y)
+  ADDITIONAL_MODULES += --add-module=$(PKG_BUILD_DIR)/nginx-headers-more
+endif
 ifeq ($(CONFIG_NGINX_NAXSI),y)
   ADDITIONAL_MODULES += --add-module=$(PKG_BUILD_DIR)/nginx-naxsi/naxsi_src
 endif
@@ -255,8 +259,23 @@
     $(call Build/Prepare/Default)
     $(if $(CONFIG_NGINX_NAXSI),$(call Prepare/nginx-naxsi))
     $(if $(CONFIG_NGINX_LUA),$(call Prepare/lua-nginx))
+    $(if $(CONFIG_NGINX_HEADERS_MORE),$(call Prepare/nginx-headers-more))
+endef
+
+define Download/nginx-headers-more
+    VERSION:=master
+    SUBDIR:=nginx-headers-more
+    FILE:=headers-more-nginx-module-$(PKG_VERSION)-$$(VERSION).tar.gz
+    URL:=https://github.com/openresty/headers-more-nginx-module.git
+    PROTO:=git
 endef
 
+define  Prepare/nginx-headers-more
+    $(eval $(call Download,nginx-headers-more))
+    gzip -dc $(DL_DIR)/$(FILE) | tar -C $(PKG_BUILD_DIR) $(TAR_OPTIONS)
+endef
+
+
 define Download/nginx-naxsi
     VERSION:=cf73f9c8664127252c2a4958d2e169516d3845a1
     SUBDIR:=nginx-naxsi

--- ./feeds/packages/net/nginx/Config.in    2017-06-17 16:53:01.358481000 +0200
+++ ./feeds/packages/net/nginx/Config.in    2017-06-17 17:26:40.543174999 +0200
@@ -15,6 +15,13 @@
         Enable HTTPS/SSL support.
     default n
 
+config NGINX_HEADERS_MORE
+    bool
+    prompt "Enable Headers_more module"
+    help
+        Set and clear input and output headers...more than "add"!
+    default y
+
 config NGINX_DAV
     bool
     prompt "Enable WebDAV module"

And You can use "more_*_headers" directives in nginx config files. Enjoy my first code modification! :triumph:

why not create a pull request ?


here the pr
https://github.com/openwrt/packages/pull/6157

headers_more is additional module for nginx and in mainstream Linux is added only in package like nginx-extra/full/custom so I thought it won't be accepted.
But I can confirm that it works perfect with latest stable 1.14.0 :slight_smile: (on 17.01)
Maybe next module will be WAF for nginx (modsecurity) as it stops relay on apache?

They are additional module so just make it optional so that if someone needs it, he can compile it himself