Removing X-Cache, X-Served-By from HTTP Header



  • Maksim Galanter

    [quote="alex, post:1, topic:664"] remove [/quote]

    Hi Alex,

    Could you try using "unset" instead of "remove". This should remove those headers from your response.

    As far as preventing modification; that would require taking a look at what else is going on in your vcl, which we would be happy to do if you wanted to send a ticket to

    Hope that helps! Maksim

  • Alex G

    Yes, there is a return(deliver); statement before the remove/unset statement. I'm sure this is adding the removed HTTP headers again. What happens when removing the return(deliver); statement?

    Here is my current vcl_deliver


    Removes various HTTP header variables.

    sub modifyhttpheaders { remove resp.http.X-Cache-Debug; remove resp.http.X-Backend-Key; remove resp.http.Server; # gunicorn/0.14.3 remove resp.http.Via; # 1.1 vegur, 1.1 varnish remove resp.http.X-Served-By; # cache-lcy1132-LCY remove resp.http.X-Cache; # MISS remove resp.http.X-Cache-Hits; # 0 remove resp.http.X-Timer; }

    sub vcldeliver { call modifyhttp_headers;

    FASTLY deliver

    return(deliver); } ```

  • Rogier Mulhuijzen

    Ah, so the #FASTLY deliver part is where those headers get added. So you'll want to put the call between it and the return(deliver);. Like so:

    ``` sub vcl_deliver {

    FASTLY deliver

    call modifyhttpheaders; return(deliver); } ```

    Can you also check in the generated VCL (hit the VCL button at the top of the GUI to view) to see if there's no return lines in there. The #FASTLY deliver get's expanded to something like # FASTLY deliver START and # FASTLY deliver END.

  • Alex G

    Perfect, that is working! Thank you

Please sign in to leave a comment.