Custom Headers in the Accelerator

You occasionally need to collect certain information at your application that cannot–and even shouldn’t–be passed through GET or POST methods.

For example, if your server is behind a reverse proxy (and such is the case with Snapt), you might want to know which part of your infrastructure handled over the request to later be able to perform certain analytics. Or perhaps you are a protocol designer and are testing things out, and want to flag some processes to let your application know you’re on a sandbox and can relax–or enforce–certain restrictions.

Whichever the case, you can apply custom HTTP headers through the Accelerator settings.

Customizing headers is an advanced setting, so bear in mind there are a series of considerations, including such as security concerns, that you must address when implementing application protocols or creating new parameters.

For more information see RFC 6648 by the Internet Engineering Task Force (ETF).

How to Add Custom Headers

If the server to which you want to pass the custom header is being cached, you can add the custom herders right from the Cache Profile.

Navigate to:

Accelerator > Caching > Cache Profile

Under the View Profiles tab, click on the Settings button for the Cache Profile you intend to change (most probably Default).

In the Options pane, you’ll find the Custom Headers [Advanced] field where you can enter, one per line, your custom headers.

Click the Save button.

Example: Source IP with X-Forwarded-For(XFF)

Any connection through the proxy would only reveal the originating IP address of the proxy server, namely, your Snapt instance.

To address this issue, you add an X-Forwarded-For (XFF) HTTP header field, which is a method commonly used to identify the originating IP address of a client that’s connecting to a web server through an HTTP proxy or load balancer.