Hi,
I'm experimenting with nginx to have it respond in an incompatible wait to a
HTTP client. A normal response would be like the usual:
HTTP/1.1 200 OK
Content-Type: text/plain
...
I would like to modify the HTTP response to this instead, using nginx and
perhaps some lua scripting if needed:
UNKNOWN 200 OK
Content-Type: text/plain
...
Is this possible without hacking nginx sources or manipulative intermediate
proxies?
/Martin
On Mon, 10 Jun 202409:56:05 +0100,
Martin Kjær Jørgensen via nginx <nginx at nginx.org> wrote:
>
>
> Is this possible without hacking nginx sources or manipulative intermediate
> proxies?
>
As you may see in ngx_http_header_filter_module.c such stringis hardcoded.
--
wbr, Kirill
Hello,
On Thu, 13 Jun 202416:05:18 +0100
Kirill A. Korinsky <kirill at korins.ky> wrote:
> On Mon, 10 Jun 202409:56:05 +0100,
> Martin Kjær Jørgensen via nginx <nginx at nginx.org> wrote:
> >
> >
> > Is this possible without hacking nginx sources or manipulative intermediate
> > proxies?
> >
>
> As you may see in ngx_http_header_filter_module.c such string is hardcoded.
>
Indeed.
I'd reccomend stream njs, with it's filter phase handler, js_filter[1],
if you prefer to perform such intermediary manipulation within nginx
itself.
There is an example of performing HTTP manipulation with js_filter
here[2], albeit for injecting a custom header, but the same approach
would with the 'download' callback.
The Stream module itself can do TLS offloading[3], now has Virtual
Servers[4], and now has direct pass to http listener feature[5] making
such hacks more workable and efficient :).
[1]https://nginx.org/en/docs/stream/ngx_stream_js_module.html#js_filter
[2]https://github.com/nginx/njs-examples/blob/master/njs/stream/inject_header.js
[3]https://nginx.org/en/docs/stream/ngx_stream_ssl_module.html
[4]https://nginx.org/en/docs/stream/ngx_stream_core_module.html#server_name
[5]https://nginx.org/en/docs/stream/ngx_stream_pass_module.html
On Mon, 10 Jun 2024 09:56:05 +0100, Martin Kjær Jørgensen via nginx <nginx at nginx.org> wrote: > > > Is this possible without hacking nginx sources or manipulative intermediate > proxies? > As you may see in ngx_http_header_filter_module.c such string is hardcoded. -- wbr, Kirill
Hello, On Thu, 13 Jun 2024 16:05:18 +0100 Kirill A. Korinsky <kirill at korins.ky> wrote: > On Mon, 10 Jun 2024 09:56:05 +0100, > Martin Kjær Jørgensen via nginx <nginx at nginx.org> wrote: > > > > > > Is this possible without hacking nginx sources or manipulative intermediate > > proxies? > > > > As you may see in ngx_http_header_filter_module.c such string is hardcoded. > Indeed. I'd reccomend stream njs, with it's filter phase handler, js_filter[1], if you prefer to perform such intermediary manipulation within nginx itself. There is an example of performing HTTP manipulation with js_filter here[2], albeit for injecting a custom header, but the same approach would with the 'download' callback. The Stream module itself can do TLS offloading[3], now has Virtual Servers[4], and now has direct pass to http listener feature[5] making such hacks more workable and efficient :). [1]https://nginx.org/en/docs/stream/ngx_stream_js_module.html#js_filter [2]https://github.com/nginx/njs-examples/blob/master/njs/stream/inject_header.js [3]https://nginx.org/en/docs/stream/ngx_stream_ssl_module.html [4]https://nginx.org/en/docs/stream/ngx_stream_core_module.html#server_name [5]https://nginx.org/en/docs/stream/ngx_stream_pass_module.html