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 and X-SaaS-Domains-IP headers

When a request is forwarded from a custom domain to your upstream, the X-Served-For and X-SaaS-Domains-IP headers will be added to the request.

X-Served-For contains information about the custom domain for which the request was forwarded.

X-SaaS-Domains-IP contains information about the IP address of the client sending the request.

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.

A client with IP 37.228.203.125 makes a request to https://app.mydomain.com.

The X-Served-For header will be added to the forwarded request with the value app.mydomain.com.

The X-SaaS-Domains-IP header will be added to the forwarded request with the value 37.228.203.125.

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