Enable sub_filter module in the webgateway nginx docker container
I am trying to do a rewrite using the webgateway-nginx docker container but getting an "unknown directive sub_filter' message. How can I add additional nginx modules into a webgateway nginx container?
Comments
The available documentation says that webgateway containers already include a web server preconfigured with a Web Gateway extension, and that in a containerized deployment you should automate web server configuration by amending the web server configuration programmatically within the image’s Dockerfile or by describing it in the container cluster YAML. It does not describe a supported mechanism for adding extra nginx modules to the webgateway-nginx container. [1]
The nginx build guidance for the Web Gateway shows that nginx module support depends on how nginx itself is built. The documented build examples include options such as --with-http_ssl_module, and note that the build process can be changed to include or exclude optional nginx capabilities by changing the configure arguments. That indicates module availability is determined at nginx build time rather than by a Web Gateway setting. [2]
The webgateway-nginx:latest-em example shows the image’s nginx was built with these configure arguments:
--prefix=/opt/nginx --with-pcre=/opt/pcre-src --with-zlib=/opt/zlib-src --with-openssl=/opt/openssl-src --with-http_gunzip_module --with-http_ssl_module --with-http_v2_module --add-module=/opt/nginx-src/csp
sub_filter is not listed there, which is consistent with nginx reporting unknown directive sub_filter. [3]
So, based on the returned material, the practical conclusion is that you would need a custom-built nginx image if you require additional nginx modules such as sub_filter, and container customization should be done in the image Dockerfile or deployment YAML. The provided documents do not give a supported step-by-step process for rebuilding the InterSystems webgateway-nginx container with extra nginx modules. [1][2][3]
Important: Use of the Universal Modules with Nginx has been deprecated due to stability issues. Deployments of the Web Gateway which connect to Nginx using the NSD fully support all features, including WebSockets. [2]
If you are currently using the Universal Modules with Nginx, InterSystems recommends upgrading to the most recent version of the Web Gateway and rebuilding your Nginx server to work with the NSD. Be sure to remove the CSPModulePath directive from your server configuration when you edit the server configuration file. [2]
This means if you decide to build your own nginx-based solution, the documented recommendation is to use the NSD-based Web Gateway approach rather than the deprecated Universal Modules approach. [2]
Sources: