Also make sure proxy.config.http.cache.allow_empty_doc is enabled. Should be enabled by default.
https://docs.trafficserver.apache.org/en/latest/admin-guide/files/records.config.en.html?highlight=empty#proxy-config-http-cache-allow-empty-doc On Wed, Nov 16, 2016 at 10:13 PM, Bryan Call <[email protected]> wrote: > I think it would be better to not use redirect and just use the > header_rewrite to do the redirect and set the cache-control header. Here > is an example: > > *Config:* > [bcall@homer ~]$ tail -1 /usr/local/etc/trafficserver/remap.config > #redirect http://www.google.com/ http://www.yahoo.com/ > @plugin=header_rewrite.so @pparam=/usr/local/etc/trafficserver/foo.config > [bcall@homer ~]$ cat /usr/local/etc/trafficserver/foo.config > set-redirect 302 http://www.yahoo.com/%{PATH} > > cond %{SEND_RESPONSE_HDR_HOOK} > rm-header Cache-Control > set-header Cache-Control "max-age=600, public" > > *Test:* > [bcall@homer ~]$ curl -D - -H 'Host: www.google.com' > http://127.0.0.1:8080/ > HTTP/1.1 302 Redirect > Date: Thu, 17 Nov 2016 03:13:22 GMT > Connection: keep-alive > Server: ATS/7.1.0 > Location: http://www.yahoo.com/ > Content-Type: text/html > Content-Language: en > Cache-Control: max-age=600, public > Content-Length: 303 > > -Bryan > > > > > On Nov 16, 2016, at 5:18 PM, Bryan Call <[email protected]> wrote: > > I ran a test myself and I don’t know of a way to make the response > cacheable. I assume you would like to set the Cache-Control header to > something like max-age=300. I will talk to a couple other Committers > tonight and see if they have any ideas. > > This is what I am seeing: > [bcall@homer ~]$ curl -D - -H 'Host: www.google.com' > http://127.0.0.1:8080/ > HTTP/1.1 301 Redirect > Date: Wed, 16 Nov 2016 08:13:03 GMT > Connection: keep-alive > Server: ATS/7.1.0 > *Cache-Control: no-store* > Location: http://www.yahoo.com/ > Content-Type: text/html > Content-Language: en > Content-Length: 303 > > -Bryan > > > > > On Nov 15, 2016, at 3:19 AM, $ubbu <[email protected]> wrote: > > Hi everyone > > I am unable to cache the redirected urls, any way to cache the > redirected pages? > > my rule is like this > > redirect http://server1.example.com/ http://serveraz.example.com/ > > -- > *Regards* > > *Subrahmanya Prasad P* > > > >
