Skip to content

How to read AuthenticationProviderKey, DownstreamPathTemplate, DownstreamHostAndPorts based on the UpstreamPath as input? #1987

Answered by raman-m
pradeep1403 asked this question in Q&A
Discussion options

You must be logged in to vote

Hi @pradeep1403 !
Welcome to Ocelot world! 🐯

In what place/class/middleware do you need properties of the route?

Anyway, route information can be found like this:

  • Read HttpContext.Items helpers (see HttpItemsExtensions class). So, you need to use the couple of these methods: UpsertDownstreamRoute and DownstreamRoute. Look into the Ocelot code and you will see tons of examples how to use these extensions
  • Use IOptions<T> pattern to inject the config model into a constructor. The 1st example of IOptions<FileConfiguration> usage is here:

IOptions<FileConfiguration> fileConfiguration,

S…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by raman-m
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
Configuration Ocelot feature: Configuration Routing Ocelot feature: Routing
2 participants