regex - Nginx string manipulation on a variable -
Is there any way I can change the string on nginx variable I use nginx as proxy for s3 restricted downloads I am doing And I'm forwarding $ upstream_http_etag
to the feedback header with different names.
add_header Content-MD5 $ upstream_http_etag; Proxy_set_header content- MD5 $ upstream_http_etag;
The problem is the tag double quoted
. I wanted to remove this double quotes before adding it to the header. There is a possible way to do this.
I know that I can strip it to the client. But this is for older apps to work without updates.
Any help is greatly appreciated.
For example,
space / {header_filter_by_lua '-Double remove} quoted local value = string.gsub (ngx.var.upstream_http_etag or "", [[^ "(. +)" $]], "% 1") - Feedback header Add ngx.header ["content-MD5"] = value '; Proxy_pass ...; }
BTW, proxy_set_header
is used to pass the upstream to the additional request header, however, $ upstream_http_etag
upstream Response header is
Therefore proxy_set_header content- MD5 $ upstream_http_etag;
There is no point.
Comments
Post a Comment