You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@trafficserver.apache.org by Vasanth Mathivanan <va...@evolutiondigital.com> on 2019/04/09 13:46:19 UTC

Need to remove header in ATS

Hi all ,

I have created regex remap for redirect one origin to another origin based  . But if I post  response from curl it throws with lot of headers . So I just need to remove location and Cache-Control  header from that response .I tried with header rewrite plugin but no luck for me ,  How can I do that ?

Remap:

map   http://10.137.x.x:8004/      http://192.168.x.x @plugin=regex_remap.so @pparam=maps.reg @plugin=header_rewrite.so @pparam=hdr.config

maps.reg

^/new/(.*)$      http://192.168.x.x /$0 @status=302

Hdr.config

cond %{READ_RESPONSE_HDR_HOOK}
rm-header Cache-Control
rm-header Location
rm-header Content-Type
rm-header Pragma

curl response :

[root@ceph-admin trafficserver]# curl -I 10.137.x.x:8004/new/new2/new3/index.html
HTTP/1.1 302 Redirect
Date: Tue, 09 Apr 2019 13:34:33 GMT
Connection: keep-alive
Via: http/1.1 qa.ivzapp.com (ApacheTrafficServer/6.2.2 [uSc s f p eM:tNc  i p s ])
Server: ATS/6.2.2
Cache-Control: no-store
Location: http://192.168.x.x//new/new2/new3/index.html
Content-Type: text/html
Content-Language: en
Content-Length: 327


Thanks
__Vasanth

Sent from Mail<https://go.microsoft.com/fwlink/?LinkId=550986> for Windows 10


RE: Need to remove header in ATS

Posted by Vasanth Mathivanan <va...@evolutiondigital.com>.
Hi Miles ,

Seems its working with add-header and rm-header for 200 responses  . When I set redirect requests can’t  remove that header .Below example i was set the header config as rm-header Content-Length with cond %{SEND_RESPONSE_HDR_HOOK} if  same time 200 responses could be removed but redirected requests can’t remove there. Using Requests are redirected with regex_remap and status will be posted 301 .



Is this possible to remove header redirect/custom status requests ?

200 response (it has been removed Content Length):



[root@ceph-admin trafficserver]# curl -I 10.137.x.x:8004/test/sample.html

HTTP/1.1 200 OK

Date: Wed, 10 Apr 2019 17:04:46 GMT

Server: ATS/6.2.2

Last-Modified: Mon, 25 Mar 2019 09:45:19 GMT

ETag: "46c9f-10-584e81009d3d3"

Accept-Ranges: bytes

Content-Type: text/html; charset=UTF-8

Age: 0

Connection: keep-alive

Via: http/1.1 x.x.x..com (ApacheTrafficServer/6.2.2 [uScMsSf pSeN:t cCMi p sS])





301 responses:



[root@ceph-admin trafficserver]# curl -I 10.137.x.x.:8004/test/sample.html

HTTP/1.1 301 Redirect

Date: Wed, 10 Apr 2019 16:59:54 GMT

Connection: keep-alive

Via: http/1.1 x.x.x.com (ApacheTrafficServer/6.2.2 [uSc s f p eN:tNc  i p s ])

Server: ATS/6.2.2

Cache-Control: no-store

Location: http://192.168.x.x/test1/sample.html

Content-Type: text/html

Content-Language: en

Content-Length: 319



Thanks

__Vasanth



Sent from Mail<https://go.microsoft.com/fwlink/?LinkId=550986> for Windows 10



From: Miles Libbey<ma...@apache.org>
Sent: Wednesday, April 10, 2019 9:48 PM
To: users@trafficserver.apache.org<ma...@trafficserver.apache.org>
Subject: Re: Need to remove header in ATS



Your original code looked right to me. So, I'm wondering if something
else is preventing it from firing... permissions, installation, wrong
path... something. Can you make it some other trivial task to make
sure its loading? Like
cond %{SEND_RESPONSE_HDR_HOOK}
add-header Foo "bar"

(and make sure you see the Foo header -- touch remap.config;
traffic_ctl config reload; and then tail your logs to watch for load
errors)

On Wed, Apr 10, 2019 at 8:55 AM Vasanth Mathivanan
<va...@evolutiondigital.com> wrote:
>
> I was tried with SEND_REPONSE could not work .Please give any other solutions .
>
> Thanks
> __Vasanth
>
>
>
> Sent from Mail for Windows 10
>
>
>
> From: Alan Carroll
> Sent: Wednesday, April 10, 2019 8:41 PM
> To: users@trafficserver.apache.org
> Subject: Re: Need to remove header in ATS
>
>
>
> I'd try SEND_RESPONSE_HDR_HOOK - those headers are likely added adtrer READ_RESPONSE_HDR_HOOK.
>
> On Tue, Apr 9, 2019 at 8:54 AM Vasanth Mathivanan <va...@evolutiondigital.com> wrote:
>>
>> Hi all ,
>>
>>
>>
>> I have created regex remap for redirect one origin to another origin based  . But if I post  response from curl it throws with lot of headers . So I just need to remove location and Cache-Control  header from that response .I tried with header rewrite plugin but no luck for me ,  How can I do that ?
>>
>>
>>
>> Remap:
>>
>>
>>
>> map   http://10.137.x.x:8004/      http://192.168.x.x @plugin=regex_remap.so @pparam=maps.reg @plugin=header_rewrite.so @pparam=hdr.config
>>
>>
>>
>> maps.reg
>>
>>
>>
>> ^/new/(.*)$      http://192.168.x.x /$0 @status=302
>>
>>
>>
>> Hdr.config
>>
>>
>>
>> cond %{READ_RESPONSE_HDR_HOOK}
>>
>> rm-header Cache-Control
>>
>> rm-header Location
>>
>> rm-header Content-Type
>>
>> rm-header Pragma
>>
>>
>>
>> curl response :
>>
>>
>>
>> [root@ceph-admin trafficserver]# curl -I 10.137.x.x:8004/new/new2/new3/index.html
>>
>> HTTP/1.1 302 Redirect
>>
>> Date: Tue, 09 Apr 2019 13:34:33 GMT
>>
>> Connection: keep-alive
>>
>> Via: http/1.1 qa.ivzapp.com (ApacheTrafficServer/6.2.2 [uSc s f p eM:tNc  i p s ])
>>
>> Server: ATS/6.2.2
>>
>> Cache-Control: no-store
>>
>> Location: http://192.168.x.x//new/new2/new3/index.html
>>
>> Content-Type: text/html
>>
>> Content-Language: en
>>
>> Content-Length: 327
>>
>>
>>
>>
>>
>> Thanks
>> __Vasanth
>>
>>
>>
>> Sent from Mail for Windows 10
>>
>>

Re: Need to remove header in ATS

Posted by Miles Libbey <ml...@apache.org>.
Your original code looked right to me. So, I'm wondering if something
else is preventing it from firing... permissions, installation, wrong
path... something. Can you make it some other trivial task to make
sure its loading? Like
cond %{SEND_RESPONSE_HDR_HOOK}
add-header Foo "bar"

(and make sure you see the Foo header -- touch remap.config;
traffic_ctl config reload; and then tail your logs to watch for load
errors)

On Wed, Apr 10, 2019 at 8:55 AM Vasanth Mathivanan
<va...@evolutiondigital.com> wrote:
>
> I was tried with SEND_REPONSE could not work .Please give any other solutions .
>
> Thanks
> __Vasanth
>
>
>
> Sent from Mail for Windows 10
>
>
>
> From: Alan Carroll
> Sent: Wednesday, April 10, 2019 8:41 PM
> To: users@trafficserver.apache.org
> Subject: Re: Need to remove header in ATS
>
>
>
> I'd try SEND_RESPONSE_HDR_HOOK - those headers are likely added adtrer READ_RESPONSE_HDR_HOOK.
>
> On Tue, Apr 9, 2019 at 8:54 AM Vasanth Mathivanan <va...@evolutiondigital.com> wrote:
>>
>> Hi all ,
>>
>>
>>
>> I have created regex remap for redirect one origin to another origin based  . But if I post  response from curl it throws with lot of headers . So I just need to remove location and Cache-Control  header from that response .I tried with header rewrite plugin but no luck for me ,  How can I do that ?
>>
>>
>>
>> Remap:
>>
>>
>>
>> map   http://10.137.x.x:8004/      http://192.168.x.x @plugin=regex_remap.so @pparam=maps.reg @plugin=header_rewrite.so @pparam=hdr.config
>>
>>
>>
>> maps.reg
>>
>>
>>
>> ^/new/(.*)$      http://192.168.x.x /$0 @status=302
>>
>>
>>
>> Hdr.config
>>
>>
>>
>> cond %{READ_RESPONSE_HDR_HOOK}
>>
>> rm-header Cache-Control
>>
>> rm-header Location
>>
>> rm-header Content-Type
>>
>> rm-header Pragma
>>
>>
>>
>> curl response :
>>
>>
>>
>> [root@ceph-admin trafficserver]# curl -I 10.137.x.x:8004/new/new2/new3/index.html
>>
>> HTTP/1.1 302 Redirect
>>
>> Date: Tue, 09 Apr 2019 13:34:33 GMT
>>
>> Connection: keep-alive
>>
>> Via: http/1.1 qa.ivzapp.com (ApacheTrafficServer/6.2.2 [uSc s f p eM:tNc  i p s ])
>>
>> Server: ATS/6.2.2
>>
>> Cache-Control: no-store
>>
>> Location: http://192.168.x.x//new/new2/new3/index.html
>>
>> Content-Type: text/html
>>
>> Content-Language: en
>>
>> Content-Length: 327
>>
>>
>>
>>
>>
>> Thanks
>> __Vasanth
>>
>>
>>
>> Sent from Mail for Windows 10
>>
>>

Re: Need to remove header in ATS

Posted by Alan Carroll <so...@verizonmedia.com>.
Shouldn't your `curl` use `--proxy` to talk to ATS instead of the upstream?

On Wed, Apr 10, 2019 at 10:55 AM Vasanth Mathivanan <
vasanth.m@evolutiondigital.com> wrote:

> I was tried with SEND_REPONSE could not work .Please give any other
> solutions .
>
> Thanks
> __Vasanth
>
>
>
> Sent from Mail <https://go.microsoft.com/fwlink/?LinkId=550986> for
> Windows 10
>
>
>
> *From: *Alan Carroll <so...@verizonmedia.com>
> *Sent: *Wednesday, April 10, 2019 8:41 PM
> *To: *users@trafficserver.apache.org
> *Subject: *Re: Need to remove header in ATS
>
>
> I'd try SEND_RESPONSE_HDR_HOOK - those headers are likely added adtrer
> READ_RESPONSE_HDR_HOOK.
>
> On Tue, Apr 9, 2019 at 8:54 AM Vasanth Mathivanan <
> vasanth.m@evolutiondigital.com> wrote:
>
>> Hi all ,
>>
>>
>>
>> I have created regex remap for redirect one origin to another origin
>> based  . But if I post  response from curl it throws with lot of headers .
>> So I just need to remove location and Cache-Control  header from that
>> response .I tried with header rewrite plugin but no luck for me ,  How can
>> I do that ?
>>
>>
>>
>> *Remap:*
>>
>>
>>
>> *map   http://10.137.x.x:8004/ <http://10.137.x.x:8004/>
>> http://192.168.x.x <http://192.168.x.x> @plugin=regex_remap.so
>> @pparam=maps.reg @plugin=header_rewrite.so @pparam=hdr.config*
>>
>>
>>
>> maps.reg
>>
>>
>>
>> *^/new/(.*)$      http://192.168.x.x <http://192.168.x.x> /$0 @status=302*
>>
>>
>>
>> *Hdr.config*
>>
>>
>>
>> *cond %{READ_RESPONSE_HDR_HOOK}*
>>
>> *rm-header Cache-Control*
>>
>> *rm-header Location*
>>
>> *rm-header Content-Type*
>>
>> *rm-header Pragma*
>>
>>
>>
>> *curl response :*
>>
>>
>>
>> *[root@ceph-admin trafficserver]# curl -I
>> 10.137.x.x:8004/new/new2/new3/index.html*
>>
>> *HTTP/1.1 302 Redirect*
>>
>> *Date: Tue, 09 Apr 2019 13:34:33 GMT*
>>
>> *Connection: keep-alive*
>>
>> *Via: http/1.1 qa.ivzapp.com <http://qa.ivzapp.com>
>> (ApacheTrafficServer/6.2.2 [uSc s f p eM:tNc  i p s ])*
>>
>> *Server: ATS/6.2.2*
>>
>> *Cache-Control: no-store*
>>
>> *Location: http://192.168.x.x//new/new2/new3/index.html
>> <http://192.168.x.x//new/new2/new3/index.html>*
>>
>> *Content-Type: text/html*
>>
>> *Content-Language: en*
>>
>> *Content-Length: 327*
>>
>>
>>
>>
>>
>> Thanks
>> __Vasanth
>>
>>
>>
>> Sent from Mail <https://go.microsoft.com/fwlink/?LinkId=550986> for
>> Windows 10
>>
>>
>>
>

RE: Need to remove header in ATS

Posted by Vasanth Mathivanan <va...@evolutiondigital.com>.
I was tried with SEND_REPONSE could not work .Please give any other solutions .

Thanks
__Vasanth

Sent from Mail<https://go.microsoft.com/fwlink/?LinkId=550986> for Windows 10

From: Alan Carroll<ma...@verizonmedia.com>
Sent: Wednesday, April 10, 2019 8:41 PM
To: users@trafficserver.apache.org<ma...@trafficserver.apache.org>
Subject: Re: Need to remove header in ATS

I'd try SEND_RESPONSE_HDR_HOOK - those headers are likely added adtrer READ_RESPONSE_HDR_HOOK.

On Tue, Apr 9, 2019 at 8:54 AM Vasanth Mathivanan <va...@evolutiondigital.com>> wrote:
Hi all ,

I have created regex remap for redirect one origin to another origin based  . But if I post  response from curl it throws with lot of headers . So I just need to remove location and Cache-Control  header from that response .I tried with header rewrite plugin but no luck for me ,  How can I do that ?

Remap:

map   http://10.137.x.x:8004/      http://192.168.x.x @plugin=regex_remap.so @pparam=maps.reg @plugin=header_rewrite.so @pparam=hdr.config

maps.reg

^/new/(.*)$      http://192.168.x.x /$0 @status=302

Hdr.config

cond %{READ_RESPONSE_HDR_HOOK}
rm-header Cache-Control
rm-header Location
rm-header Content-Type
rm-header Pragma

curl response :

[root@ceph-admin trafficserver]# curl -I 10.137.x.x:8004/new/new2/new3/index.html
HTTP/1.1 302 Redirect
Date: Tue, 09 Apr 2019 13:34:33 GMT
Connection: keep-alive
Via: http/1.1 qa.ivzapp.com<http://qa.ivzapp.com> (ApacheTrafficServer/6.2.2 [uSc s f p eM:tNc  i p s ])
Server: ATS/6.2.2
Cache-Control: no-store
Location: http://192.168.x.x//new/new2/new3/index.html
Content-Type: text/html
Content-Language: en
Content-Length: 327


Thanks
__Vasanth

Sent from Mail<https://go.microsoft.com/fwlink/?LinkId=550986> for Windows 10


Re: Need to remove header in ATS

Posted by Alan Carroll <so...@verizonmedia.com>.
I'd try SEND_RESPONSE_HDR_HOOK - those headers are likely added adtrer
READ_RESPONSE_HDR_HOOK.

On Tue, Apr 9, 2019 at 8:54 AM Vasanth Mathivanan <
vasanth.m@evolutiondigital.com> wrote:

> Hi all ,
>
>
>
> I have created regex remap for redirect one origin to another origin based
>  . But if I post  response from curl it throws with lot of headers . So I
> just need to remove location and Cache-Control  header from that response
> .I tried with header rewrite plugin but no luck for me ,  How can I do that
> ?
>
>
>
> *Remap:*
>
>
>
> *map   http://10.137.x.x:8004/ <http://10.137.x.x:8004/>
> http://192.168.x.x <http://192.168.x.x> @plugin=regex_remap.so
> @pparam=maps.reg @plugin=header_rewrite.so @pparam=hdr.config*
>
>
>
> maps.reg
>
>
>
> *^/new/(.*)$      http://192.168.x.x <http://192.168.x.x> /$0 @status=302*
>
>
>
> *Hdr.config*
>
>
>
> *cond %{READ_RESPONSE_HDR_HOOK}*
>
> *rm-header Cache-Control*
>
> *rm-header Location*
>
> *rm-header Content-Type*
>
> *rm-header Pragma*
>
>
>
> *curl response :*
>
>
>
> *[root@ceph-admin trafficserver]# curl -I
> 10.137.x.x:8004/new/new2/new3/index.html*
>
> *HTTP/1.1 302 Redirect*
>
> *Date: Tue, 09 Apr 2019 13:34:33 GMT*
>
> *Connection: keep-alive*
>
> *Via: http/1.1 qa.ivzapp.com <http://qa.ivzapp.com>
> (ApacheTrafficServer/6.2.2 [uSc s f p eM:tNc  i p s ])*
>
> *Server: ATS/6.2.2*
>
> *Cache-Control: no-store*
>
> *Location: http://192.168.x.x//new/new2/new3/index.html
> <http://192.168.x.x//new/new2/new3/index.html>*
>
> *Content-Type: text/html*
>
> *Content-Language: en*
>
> *Content-Length: 327*
>
>
>
>
>
> Thanks
> __Vasanth
>
>
>
> Sent from Mail <https://go.microsoft.com/fwlink/?LinkId=550986> for
> Windows 10
>
>
>