mirror of
https://github.com/nsnail/Ocelot.git
synced 2025-06-18 23:38:16 +08:00
Feature/#623 (#632)
* #630 only set status code if response hasnt started, otherwise exception * #623 made {RemoteIpAddress} available as placeholder so you can do x-forwarded-for * #623 local address different on mac, windows and linux for integration test
This commit is contained in:
@ -81,6 +81,7 @@ Placeholders
|
||||
|
||||
Ocelot allows placeholders that can be used in header transformation.
|
||||
|
||||
{RemoteIpAddress} - This will find the clients IP address using _httpContextAccessor.HttpContext.Connection.RemoteIpAddress.ToString() so you will get back some IP.
|
||||
{BaseUrl} - This will use Ocelot's base url e.g. http://localhost:5000 as its value.
|
||||
{DownstreamBaseUrl} - This will use the downstream services base url e.g. http://localhost:5000 as its value. This only works for DownstreamHeaderTransform at the moment.
|
||||
{TraceId} - This will use the Butterfly APM Trace Id. This only works for DownstreamHeaderTransform at the moment.
|
||||
@ -120,6 +121,17 @@ finally if you are using a load balancer with Ocelot you will get multiple downs
|
||||
"AllowAutoRedirect": false,
|
||||
},
|
||||
|
||||
X-Forwarded-For
|
||||
^^^^^^^^^^^^^^^
|
||||
|
||||
An example of using {RemoteIpAddress} placeholder...
|
||||
|
||||
.. code-block:: json
|
||||
|
||||
"UpstreamHeaderTransform": {
|
||||
"X-Forwarded-For": "{RemoteIpAddress}"
|
||||
}
|
||||
|
||||
Future
|
||||
^^^^^^
|
||||
|
||||
|
Reference in New Issue
Block a user