Hello, everyone

When upstream services handle incoming requests from APISIX, they may
sometimes need know the connection information between client and APISIX,
such as scheme (http or https), destination port, http host etc.,
Currently the source real IP address can be fetched by the X-Real-IP header.

If the upstream service involve web page rendering, it may need to know the
scheme, http host, and destination port of the original request from client
side.

Conventionally, the headers X-Forwarded-Proto, X-Forwarded-Host,
X-Forwarded-Port are used for this requirement.

We can configure the proxy-rewrite plugin to add these headers, but I
thought this is a very commonly requirement if we use APISIX as a reverse
proxy,  using the SSL offloading, we need config the plugin for every
route, this is very tedious.

I thought we can solve this by the global way. I prefer add these headers
to the nginx.conf template in bin/apisix, would be something like

    proxy_set_header ...
    proxy_set_header X-Forwarded-Proto $scheme;
    proxy_set_header X-Forwarded-Host $http_host;
    proxy_set_header X-Forwarded-Port $server_port;
    proxy_set_header ...

As this defaut would add these headersfor every request, another way is to
config it in config.yaml to enable(default is disable).

Can anyone give some advice? Is this is needed for your scenarios?

Reply via email to