openresty / openresty/lua-nginx-module

more_clear_headers & more_set_headers does not do anything with the header

Open
#2,222 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C
Stars
11.8k
Forks
2.1k
Avg merge
6h 1m
Merged PRs (30d)
6

Description

I have nginx plus image , I installed the headers-more-nginx-module,
when I exec the container I see the module inside
I want to remove the header Server: nginx from the server response
I added load_module modules/ngx_http_headers_more_filter_module.so; to my nginx.conf
and when I add to my configuration
location ~ ^/api/entityInventory/(.*) {
more_clear_headers Server;
more_set_headers "Server: my_server";
}
I still see the header Server: nginx

the nginxplus dockerfile is:

FROM debian:bullseye-slim

LABEL maintainer="NGINX Docker Maintainers docker-maint@nginx.com"

ENV NGINX_VERSION 1.19

COPY ./nginx-repo.crt /etc/ssl/nginx/nginx-repo.crt
COPY ./nginx-repo.key /etc/ssl/nginx/nginx-repo.key

RUN --mount=type=secret,id=nginx-crt,dst=nginx-repo.crt
--mount=type=secret,id=nginx-key,dst=nginx-repo.key
set -x
&& addgroup --system --gid 101 nginx
&& adduser --system --disabled-login --ingroup nginx --no-create-home --home /nonexistent --gecos "nginx user" --shell /bin/false --uid 101 nginx
&& apt-get update
&& apt-get install --no-install-recommends --no-install-suggests -y
ca-certificates
gnupg1
lsb-release
&&
NGINX_GPGKEY=573BFD6B3D8FBC641079A6ABABF5BD827BD9BF62;
NGINX_GPGKEY_PATH=/usr/share/keyrings/nginx-archive-keyring.gpg;
export GNUPGHOME="$(mktemp -d)";
found='';
for server in
hkp://keyserver.ubuntu.com:80
pgp.mit.edu
; do
echo "Fetching GPG key $NGINX_GPGKEY from $server";
gpg1 --keyserver "$server" --keyserver-options timeout=10 --recv-keys "$NGINX_GPGKEY" && found=yes && break;
done;
test -z "$found" && echo >&2 "error: failed to fetch GPG key $NGINX_GPGKEY" && exit 1;
gpg1 --export "$NGINX_GPGKEY" > "$NGINX_GPGKEY_PATH" ;
rm -rf "$GNUPGHOME";
apt-get remove --purge --auto-remove -y gnupg1 && rm -rf /var/lib/apt/lists/*
&& nginxPackages="
nginx-plus
nginx-plus-module-headers-more
"
&& echo "Acquire::https::pkgs.nginx.com::Verify-Peer "true";" > /etc/apt/apt.conf.d/90nginx
&& echo "Acquire::https::pkgs.nginx.com::Verify-Host "true";" >> /etc/apt/apt.conf.d/90nginx
&& echo "Acquire::https::pkgs.nginx.com::SslCert "/etc/ssl/nginx/nginx-repo.crt";" >> /etc/apt/apt.conf.d/90nginx
&& echo "Acquire::https::pkgs.nginx.com::SslKey "/etc/ssl/nginx/nginx-repo.key";" >> /etc/apt/apt.conf.d/90nginx
&& printf "deb [signed-by=/usr/share/keyrings/nginx-archive-keyring.gpg] https://pkgs.nginx.com/plus/debian lsb_release -cs nginx-plus\n" > /etc/apt/sources.list.d/nginx-plus.list
&& mkdir -p /etc/ssl/nginx
&& cat nginx-repo.crt > /etc/ssl/nginx/nginx-repo.crt
&& cat nginx-repo.key > /etc/ssl/nginx/nginx-repo.key
&& apt-get update
&& apt-get install --no-install-recommends --no-install-suggests -y
$nginxPackages
curl
gettext-base
&& apt-get remove --purge -y lsb-release
&& $ apt-get install nginx-plus-module-headers-more
&& apt-get remove --purge --auto-remove -y && rm -rf /var/lib/apt/lists/* /etc/apt/sources.list.d/nginx-plus.list
&& rm -rf /etc/apt/apt.conf.d/90nginx /etc/ssl/nginx
&& ln -sf /dev/stdout /var/log/nginx/access.log
&& ln -sf /dev/stderr /var/log/nginx/error.log

EXPOSE 80

STOPSIGNAL SIGQUIT

CMD ["nginx", "-g", "daemon off;"]

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the reported nginx.conf load_module directive and location block, then compare the nginx-plus-module-headers-more installation in the Dockerfile with the running configuration. Done means identifying why the Server response remains nginx and documenting a reproducible configuration or module-level fix.

Written by the indexing model from the issue text.

Assessment

Tech stack
nginx
Domain
backend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.