Handling forwarded requests

In this guide, we will look at how to handle forwarded requests coming from your users on their custom domains.

X-Served-For header

When a request is forwarded from a custom domain to your upstream, the X-Served-For header will be added to the request. This header contains the custom domain for which the request was forwarded.

Example

You have an upstream that is listening on https://app.example.com.

You have a custom domain https://app.mydomain.com that is forwarding requests to https://app.example.com.

When a request is made to https://app.mydomain.com, the X-Served-For header will be added to the forwarded request with the value app.mydomain.com.

The Host header will be set to app.example.com.

You can use the X-Served-For header in your backend to determine which custom domain the request was made for.