xelber
xelber

Reputation: 4637

Azure API Management: X-Forwarded-Host, get the original Host

In Azure API Management, when request is passed on to the backend service, whats the best way of accessing original URL? For example the end user might request something like https://xxxx.azure-api.net/v1.4 Which is passed on to a backend service which could be hosted under https://example.com. End system needs to know the original Host client requested.

Upvotes: 0

Views: 4576

Answers (1)

Vitaliy Kurokhtin
Vitaliy Kurokhtin

Reputation: 7795

The most simple way to do that is indeed with policy:

<set-header name="X-Forwarded-Host" exists-action="override">
    <value>@(context.Request.OriginalUrl.ToUri().Host)</value>
</set-header>

Upvotes: 5

Related Questions