Why doesn't {RemoteIpAddress} placeholder work? #1766
-
Expected Behavior / New FeatureI have a ocelot.json file like this; {
"Routes": [
{
"DownstreamPathTemplate": "/api/Device/deneme1/{RemoteIpAddress}",
"DownstreamScheme": "http",
"DownstreamHostAndPorts": [
{
"Host": "newgateway",
"Port": 80
}
],
"UpstreamHttpMethod": ["POST"],
"UpstreamPathTemplate": "/Device"
}
]
} I need to get the id of client with using this. Actual Behavior / Motivation for New FeaturePlaceholder is not working. What can I do? Thank you. Specifications
|
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
Not sure exactly what is HTTPMethod of downstream because you want to @SerkanKutlu Its been time you faced this issue, are you still facing same. If yes please let us know more about it. Verified now on latest version that placeholder is working fine in every cases. |
Beta Was this translation helpful? Give feedback.
-
@SerkanKutlu Hi Serkan! You were confused by Route Placeholders feature and Headers Transform Placeholders one. |
Beta Was this translation helpful? Give feedback.
@SerkanKutlu Hi Serkan!
Because you are newbie to Ocelot! 😉
You were confused by Route Placeholders feature and Headers Transform Placeholders one.
Placeholders in paths are parts of URL you want to extract from upstream URL and substitute to downstream URL.
{RemoteIpAddress}
placeholder is the term of Headers Transformation feature, see more: Headers Transformation | Placeholders.Here is direct search link: Search for {RemoteIpAddress}
So, RemoteIpAddress value can be extracted from headers, so that is why this placeholder is a part of the Header Transformation.
You cannot use
{RemoteIpAddress}
placeholder in paths!Or, you can use it, but for URL parts substitutions only, from upstream…