Skip to content

HTTP Headers Management

Paolo Venturi edited this page May 22, 2019 · 15 revisions

Managing HTTP Headers

Carapace allows you to customize requests (from clients to Carapace, before server forwarding) and responses (from backends to Carapace, before client forwarding) by adding, removing or setting HTTP Headers.

HTTP Response Headers

In order to manage HTTP Responses headers all you need to do is:

  1. Define headers to manage
  2. Link defined headers to the actions you want all responses from has the headers

Headers configuration

In Carapace configuration you can define which headers to manage as follow:

header.i.id = HEADER_ID id to reference in actions definition
header.i.name = HEADER_NAME standard header name
header.i.value = HEADER_VALUE value of the header
header.i.mode = set|add|remove to override (set), append (add) the header value or remove it

Linking headers to Actions

Once done, in order to apply defined headers to HTTP Responses you only need to reference them in the actions:

action.i.headers = HEADER_ID1,HEADER_ID2

Debugging header

For debbugging reasons, there is a built-in header that can be add to all responsens to show selected route, action, director and backend:

X-Proxy_Path: id_selected_route;id_selected_action;id_selected_director;id_selected_backend

By default disabled, it can be enabled in Carapace configuration by setting mapper.debug=true

HTTP Request Headers

filter.1.match filter.1.type = add-x-forwarded-for | match-user-regexp | 'match-user-regexp' filter.1.param filter.1.regexp