From 99696ed5d96a5d4e6b39e3e766d039882b5136e6 Mon Sep 17 00:00:00 2001 From: Konstantin Demin Date: Fri, 8 Nov 2024 12:10:06 +0300 Subject: [PATCH] split request/response headers configuration --- angie/autoconf.dist/http-response-headers.conf | 1 + angie/conf.dist/fastcgi/headers.conf | 2 ++ angie/conf.dist/grpc/headers.conf | 2 ++ angie/conf.dist/proxy-http/headers.conf | 2 ++ angie/conf.dist/scgi/headers.conf | 2 ++ angie/conf.dist/uwsgi/headers.conf | 2 ++ .../fastcgi-request-headers.j2} | 8 +------- angie/snip.dist/fastcgi-response-headers.j2 | 7 +++++++ .../headers.conf.j2 => snip.dist/grpc-request-headers.j2} | 8 +------- angie/snip.dist/grpc-response-headers.j2 | 7 +++++++ .../http-response-headers.j2} | 1 + .../proxy-request-headers.j2} | 8 +------- angie/snip.dist/proxy-response-headers.j2 | 7 +++++++ .../headers.conf.j2 => snip.dist/scgi-request-headers.j2} | 8 +------- angie/snip.dist/scgi-response-headers.j2 | 7 +++++++ .../uwsgi-request-headers.j2} | 8 +------- angie/snip.dist/uwsgi-response-headers.j2 | 7 +++++++ 17 files changed, 52 insertions(+), 35 deletions(-) create mode 100644 angie/autoconf.dist/http-response-headers.conf create mode 100644 angie/conf.dist/fastcgi/headers.conf create mode 100644 angie/conf.dist/grpc/headers.conf create mode 100644 angie/conf.dist/proxy-http/headers.conf create mode 100644 angie/conf.dist/scgi/headers.conf create mode 100644 angie/conf.dist/uwsgi/headers.conf rename angie/{conf.dist/fastcgi/headers.conf.j2 => snip.dist/fastcgi-request-headers.j2} (52%) create mode 100644 angie/snip.dist/fastcgi-response-headers.j2 rename angie/{conf.dist/grpc/headers.conf.j2 => snip.dist/grpc-request-headers.j2} (50%) create mode 100644 angie/snip.dist/grpc-response-headers.j2 rename angie/{autoconf.dist/http-response-headers.conf.j2 => snip.dist/http-response-headers.j2} (79%) rename angie/{conf.dist/proxy-http/headers.conf.j2 => snip.dist/proxy-request-headers.j2} (50%) create mode 100644 angie/snip.dist/proxy-response-headers.j2 rename angie/{conf.dist/scgi/headers.conf.j2 => snip.dist/scgi-request-headers.j2} (52%) create mode 100644 angie/snip.dist/scgi-response-headers.j2 rename angie/{conf.dist/uwsgi/headers.conf.j2 => snip.dist/uwsgi-request-headers.j2} (52%) create mode 100644 angie/snip.dist/uwsgi-response-headers.j2 diff --git a/angie/autoconf.dist/http-response-headers.conf b/angie/autoconf.dist/http-response-headers.conf new file mode 100644 index 0000000..84afbd6 --- /dev/null +++ b/angie/autoconf.dist/http-response-headers.conf @@ -0,0 +1 @@ +include snip.d/http-response-headers; \ No newline at end of file diff --git a/angie/conf.dist/fastcgi/headers.conf b/angie/conf.dist/fastcgi/headers.conf new file mode 100644 index 0000000..5723b01 --- /dev/null +++ b/angie/conf.dist/fastcgi/headers.conf @@ -0,0 +1,2 @@ +include snip.d/fastcgi-request-headers; +include snip.d/fastcgi-response-headers; \ No newline at end of file diff --git a/angie/conf.dist/grpc/headers.conf b/angie/conf.dist/grpc/headers.conf new file mode 100644 index 0000000..d200840 --- /dev/null +++ b/angie/conf.dist/grpc/headers.conf @@ -0,0 +1,2 @@ +include snip.d/grpc-request-headers; +include snip.d/grpc-response-headers; \ No newline at end of file diff --git a/angie/conf.dist/proxy-http/headers.conf b/angie/conf.dist/proxy-http/headers.conf new file mode 100644 index 0000000..a0b0390 --- /dev/null +++ b/angie/conf.dist/proxy-http/headers.conf @@ -0,0 +1,2 @@ +include snip.d/proxy-request-headers; +include snip.d/proxy-response-headers; \ No newline at end of file diff --git a/angie/conf.dist/scgi/headers.conf b/angie/conf.dist/scgi/headers.conf new file mode 100644 index 0000000..4d3f697 --- /dev/null +++ b/angie/conf.dist/scgi/headers.conf @@ -0,0 +1,2 @@ +include snip.d/scgi-request-headers; +include snip.d/scgi-response-headers; \ No newline at end of file diff --git a/angie/conf.dist/uwsgi/headers.conf b/angie/conf.dist/uwsgi/headers.conf new file mode 100644 index 0000000..c3abdb4 --- /dev/null +++ b/angie/conf.dist/uwsgi/headers.conf @@ -0,0 +1,2 @@ +include snip.d/uwsgi-request-headers; +include snip.d/uwsgi-response-headers; \ No newline at end of file diff --git a/angie/conf.dist/fastcgi/headers.conf.j2 b/angie/snip.dist/fastcgi-request-headers.j2 similarity index 52% rename from angie/conf.dist/fastcgi/headers.conf.j2 rename to angie/snip.dist/fastcgi-request-headers.j2 index a33f6f4..594e11d 100644 --- a/angie/conf.dist/fastcgi/headers.conf.j2 +++ b/angie/snip.dist/fastcgi-request-headers.j2 @@ -1,13 +1,7 @@ +## sourced by conf.d/fastcgi/headers.conf ## hide/remove request headers {%- set req_hdr_dict = j2cfg.request_headers or {} -%} {%- for h, v in req_hdr_dict.items() %} {#- TODO: precise quotation #} fastcgi_param {{ h | as_cgi_header }} {{ v.__repr__() }}; -{%- endfor %} - -## hide response headers -{%- set resp_hdr_dict = j2cfg.response_headers or {} -%} -{%- set resp_hdr_list = resp_hdr_dict | dict_keys -%} -{%- for h in resp_hdr_list %} -fastcgi_hide_header {{ h }}; {%- endfor %} \ No newline at end of file diff --git a/angie/snip.dist/fastcgi-response-headers.j2 b/angie/snip.dist/fastcgi-response-headers.j2 new file mode 100644 index 0000000..1746e55 --- /dev/null +++ b/angie/snip.dist/fastcgi-response-headers.j2 @@ -0,0 +1,7 @@ +## sourced by conf.d/fastcgi/headers.conf +## hide response headers +{%- set resp_hdr_dict = j2cfg.response_headers or {} -%} +{%- set resp_hdr_list = resp_hdr_dict | dict_keys -%} +{%- for h in resp_hdr_list %} +fastcgi_hide_header {{ h }}; +{%- endfor %} \ No newline at end of file diff --git a/angie/conf.dist/grpc/headers.conf.j2 b/angie/snip.dist/grpc-request-headers.j2 similarity index 50% rename from angie/conf.dist/grpc/headers.conf.j2 rename to angie/snip.dist/grpc-request-headers.j2 index 38de9fb..4be0b17 100644 --- a/angie/conf.dist/grpc/headers.conf.j2 +++ b/angie/snip.dist/grpc-request-headers.j2 @@ -1,13 +1,7 @@ +## sourced by conf.d/grpc/headers.conf ## hide/remove request headers {%- set req_hdr_dict = j2cfg.request_headers or {} -%} {%- for h, v in req_hdr_dict.items() %} {#- TODO: precise quotation #} grpc_set_header {{ h }} {{ v.__repr__() }}; -{%- endfor %} - -## hide response headers -{%- set resp_hdr_dict = j2cfg.response_headers or {} -%} -{%- set resp_hdr_list = resp_hdr_dict | dict_keys -%} -{%- for h in resp_hdr_list %} -grpc_hide_header {{ h }}; {%- endfor %} \ No newline at end of file diff --git a/angie/snip.dist/grpc-response-headers.j2 b/angie/snip.dist/grpc-response-headers.j2 new file mode 100644 index 0000000..8630f4e --- /dev/null +++ b/angie/snip.dist/grpc-response-headers.j2 @@ -0,0 +1,7 @@ +## sourced by conf.d/grpc/headers.conf +## hide response headers +{%- set resp_hdr_dict = j2cfg.response_headers or {} -%} +{%- set resp_hdr_list = resp_hdr_dict | dict_keys -%} +{%- for h in resp_hdr_list %} +grpc_hide_header {{ h }}; +{%- endfor %} \ No newline at end of file diff --git a/angie/autoconf.dist/http-response-headers.conf.j2 b/angie/snip.dist/http-response-headers.j2 similarity index 79% rename from angie/autoconf.dist/http-response-headers.conf.j2 rename to angie/snip.dist/http-response-headers.j2 index 142b081..9b578a8 100644 --- a/angie/autoconf.dist/http-response-headers.conf.j2 +++ b/angie/snip.dist/http-response-headers.j2 @@ -1,3 +1,4 @@ +## sourced by autoconf.d/http-response-headers.conf ## add response headers {%- set resp_hdr_dict = j2cfg.response_headers or {} -%} {%- for h, v in resp_hdr_dict.items() %} diff --git a/angie/conf.dist/proxy-http/headers.conf.j2 b/angie/snip.dist/proxy-request-headers.j2 similarity index 50% rename from angie/conf.dist/proxy-http/headers.conf.j2 rename to angie/snip.dist/proxy-request-headers.j2 index ba2f52e..b86adc3 100644 --- a/angie/conf.dist/proxy-http/headers.conf.j2 +++ b/angie/snip.dist/proxy-request-headers.j2 @@ -1,13 +1,7 @@ +## sourced by conf.d/proxy-http/headers.conf ## hide/remove request headers {%- set req_hdr_dict = j2cfg.request_headers or {} -%} {%- for h, v in req_hdr_dict.items() %} {#- TODO: precise quotation #} proxy_set_header {{ h }} {{ v.__repr__() }}; -{%- endfor %} - -## hide response headers -{%- set resp_hdr_dict = j2cfg.response_headers or {} -%} -{%- set resp_hdr_list = resp_hdr_dict | dict_keys -%} -{%- for h in resp_hdr_list %} -proxy_hide_header {{ h }}; {%- endfor %} \ No newline at end of file diff --git a/angie/snip.dist/proxy-response-headers.j2 b/angie/snip.dist/proxy-response-headers.j2 new file mode 100644 index 0000000..bd073aa --- /dev/null +++ b/angie/snip.dist/proxy-response-headers.j2 @@ -0,0 +1,7 @@ +## sourced by conf.d/proxy-http/headers.conf +## hide response headers +{%- set resp_hdr_dict = j2cfg.response_headers or {} -%} +{%- set resp_hdr_list = resp_hdr_dict | dict_keys -%} +{%- for h in resp_hdr_list %} +proxy_hide_header {{ h }}; +{%- endfor %} \ No newline at end of file diff --git a/angie/conf.dist/scgi/headers.conf.j2 b/angie/snip.dist/scgi-request-headers.j2 similarity index 52% rename from angie/conf.dist/scgi/headers.conf.j2 rename to angie/snip.dist/scgi-request-headers.j2 index dc67c63..f6bebbd 100644 --- a/angie/conf.dist/scgi/headers.conf.j2 +++ b/angie/snip.dist/scgi-request-headers.j2 @@ -1,13 +1,7 @@ +## sourced by conf.d/scgi/headers.conf ## hide/remove request headers {%- set req_hdr_dict = j2cfg.request_headers or {} -%} {%- for h, v in req_hdr_dict.items() %} {#- TODO: precise quotation #} scgi_param {{ h | as_cgi_header }} {{ v.__repr__() }}; -{%- endfor %} - -## hide response headers -{%- set resp_hdr_dict = j2cfg.response_headers or {} -%} -{%- set resp_hdr_list = resp_hdr_dict | dict_keys -%} -{%- for h in resp_hdr_list %} -scgi_hide_header {{ h }}; {%- endfor %} \ No newline at end of file diff --git a/angie/snip.dist/scgi-response-headers.j2 b/angie/snip.dist/scgi-response-headers.j2 new file mode 100644 index 0000000..1d42218 --- /dev/null +++ b/angie/snip.dist/scgi-response-headers.j2 @@ -0,0 +1,7 @@ +## sourced by conf.d/scgi/headers.conf +## hide response headers +{%- set resp_hdr_dict = j2cfg.response_headers or {} -%} +{%- set resp_hdr_list = resp_hdr_dict | dict_keys -%} +{%- for h in resp_hdr_list %} +scgi_hide_header {{ h }}; +{%- endfor %} \ No newline at end of file diff --git a/angie/conf.dist/uwsgi/headers.conf.j2 b/angie/snip.dist/uwsgi-request-headers.j2 similarity index 52% rename from angie/conf.dist/uwsgi/headers.conf.j2 rename to angie/snip.dist/uwsgi-request-headers.j2 index 44a41b9..b045da3 100644 --- a/angie/conf.dist/uwsgi/headers.conf.j2 +++ b/angie/snip.dist/uwsgi-request-headers.j2 @@ -1,13 +1,7 @@ +## sourced by conf.d/uwsgi/headers.conf ## hide/remove request headers {%- set req_hdr_dict = j2cfg.request_headers or {} -%} {%- for h, v in req_hdr_dict.items() %} {#- TODO: precise quotation #} uwsgi_param {{ h | as_cgi_header }} {{ v.__repr__() }}; -{%- endfor %} - -## hide response headers -{%- set resp_hdr_dict = j2cfg.response_headers or {} -%} -{%- set resp_hdr_list = resp_hdr_dict | dict_keys -%} -{%- for h in resp_hdr_list %} -uwsgi_hide_header {{ h }}; {%- endfor %} \ No newline at end of file diff --git a/angie/snip.dist/uwsgi-response-headers.j2 b/angie/snip.dist/uwsgi-response-headers.j2 new file mode 100644 index 0000000..18a41fa --- /dev/null +++ b/angie/snip.dist/uwsgi-response-headers.j2 @@ -0,0 +1,7 @@ +## sourced by conf.d/uwsgi/headers.conf +## hide response headers +{%- set resp_hdr_dict = j2cfg.response_headers or {} -%} +{%- set resp_hdr_list = resp_hdr_dict | dict_keys -%} +{%- for h in resp_hdr_list %} +uwsgi_hide_header {{ h }}; +{%- endfor %} \ No newline at end of file