Page MenuHomePhabricator

Let X-Analytics response header pass through with WikimediaDebug
Open, MediumPublic

Description

Context:

  1. T196558: Send X-Analytics information from Varnish to Hadoop with VCL_Log
  2. T210484: Only serve debug HTTP headers when x-wikimedia-debug is present

The first one resulted in setting up the do_global_send_response hook in ATS and using it to strip X-Analytics for performance and usability reasons.

The second one resulted in taht hook being extended with a block that (unless using WikimediaDebug) removes a long list of generally unimportant headers.

The resulting code is a bit funny:

function do_global_send_response()
    -- https://phabricator.wikimedia.org/T196558
    ts.client_response.header['X-Analytics'] = nil

    -- Only serve debug HTTP headers when X-Wikimedia-Debug is present. T210484
    if ts.client_request.header['X-Wikimedia-Debug'] == nil then
        ts.client_response.header['Backend-Timing'] = nil
        ts.client_response.header['X-ATS-Timestamp'] = nil
        ts.client_response.header['X-Envoy-Upstream-Service-Time'] = nil
        ts.client_response.header['X-Powered-By'] = nil
        ts.client_response.header['X-Request-Id'] = nil
        ts.client_response.header['X-Timestamp '] = nil
        ts.client_response.header['X-Trans-Id'] = nil
        ts.client_response.header['X-Varnish'] = nil
    end
end

This came up as part of T301584 where it would have helped if X-Analytics could be debugged more easily than ssh'ing to a web server. I propose we move it into that block.

\cc @cjming