Page MenuHomePhabricator

ATS isn't honoring the cache policy set in cache::alternate_domains on some cases
Closed, ResolvedPublic

Description

cache::alternate_domains is used at the varnish layer to move a hostname from the (default) text cluster to misc. It's also used to set a specific caching policy that it can be one of ["normal", "pass", "pipe", "websockets"].

In the current ATS puppetization, the function profile::trafficserver_caching_rules is used to generate /etc/trafficserver/cache.config according to cache::alternate_domains content + profile::trafficserver::mapping_rules content.

If a cache::alternate_domain caching policy is set to pass it gets translated to action=never-cache in /etc/trafficserver/cache.config but if the caching policy is set to websockets, ATS considers the hostname as cacheable and varnish does the opposite:

sub wm_recv_pass {
<%
    def uc_action(uc)
        if uc == "pass"
            return "return (pass);"
        elsif uc == "pipe"
            return "return (pipe);"
        elsif uc == "websockets"
            return %Q[if (req.http.upgrade ~ "(?i)websocket") { return (pipe); } else { return (pass); }]
        elsif uc == "normal"
            return ""
        else 
            raise Error, "Invalid caching action #{uc}"
        end  
    end

Something similar happens with pipe, in pipe mode varnish behaves as a TCP proxy so it doesn't perform any kind of caching and ATS should honor that as well.

Event Timeline

Change 827506 had a related patch set uploaded (by Vgutierrez; author: Vgutierrez):

[operations/puppet@production] trafficserver: Set action=never-cache for caching=websockets

https://gerrit.wikimedia.org/r/827506

Vgutierrez triaged this task as Medium priority.
Vgutierrez updated the task description. (Show Details)
Vgutierrez moved this task from Backlog to Actively Servicing on the Traffic board.

Change 827506 merged by Vgutierrez:

[operations/puppet@production] trafficserver: Set action=never-cache for caching=websockets|pipe

https://gerrit.wikimedia.org/r/827506