Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

more_clear_headers & more_set_headers does not do anything with the header #2222

Open
Tzivia-Sofer opened this issue Aug 31, 2023 · 1 comment

Comments

@Tzivia-Sofer
Copy link

Tzivia-Sofer commented Aug 31, 2023

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;"]

@lynch1981
Copy link
Contributor

i can not reproduce this issue, can you show the output of curl?
curl -i http://yourdomain/api/entityInventory/anything

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants