Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DownstreamHostAndPorts alias #692

Open
mariotacke opened this issue Nov 16, 2018 · 8 comments
Open

DownstreamHostAndPorts alias #692

mariotacke opened this issue Nov 16, 2018 · 8 comments
Assignees
Labels
Configuration Ocelot feature: Configuration help wanted Not actively being worked on. If you plan to contribute, please drop a note. large effort Likely over a week of development effort medium effort Likely a few days of development effort proposal Proposal for a new functionality in Ocelot

Comments

@mariotacke
Copy link

My team and I are test-driving Ocelot for a new project. We are wondering if it is possible to alias the DownstreamHostAndPorts somehow without having to repeat it for many endpoints. This is especially important to us when we think about overriding host and port per environment.

For example, for development purposes, we want to have Host and Port set to localhost and 5005, but for staging and production to a different host name and port. I understand that this is possible to do via override, but we'd rather not duplicate the entire definition again.

We'd like to define multiple hosts and ports in the global configuration and reference them in the downstream host and ports section.

Example:

"GlobalConfiguration": {
  "BaseUrl": "https://our-system.net/api",
  "RequestIdKey": "X-Request-Id",
  "HostAndPorts": [
    {
      "Alias": "ServiceA",
      "Host": "localhost",
      "Port": "5005"
    }
  ]
}

Then, in the "ReRoutes" config, we'd use it instead of the host definition:

{
  "ReRoutes": [
    // other config
    "DownstreamHostAndPorts": [
      {
        "UseAlias": "ServiceA"
      }
    ]
  ]
}

Is this a use case you have come across? I guess, as a workaround, we could define host names in the hosts file of the system, but that requires all devs to have the same entries.

Specifications

  • Version: 12.0.1
  • Platform: dotnet core 2.1.5
@philproctor philproctor added the feature A new feature label Jan 9, 2019
@philproctor philproctor self-assigned this Jan 9, 2019
@golavr
Copy link

golavr commented Jan 13, 2020

@philproctor any update on this enhancement?
this feature will save a lot of configuration changes as @mariotacke mentioned
thanks

cezarypiatek added a commit to cezarypiatek/Ocelot that referenced this issue Oct 13, 2020
cezarypiatek added a commit to cezarypiatek/Ocelot that referenced this issue Oct 13, 2020
@gao-artur
Copy link

Check my answer on SO. It does exactly what you are asking for
https://stackoverflow.com/a/63601248/2557855

@NicoJuicy
Copy link

@gao-artur I had to put the configuration in my appsettings and not in the ocelot.json to make it work. But it solved my problem, thanks!

@raman-m raman-m assigned mariotacke and unassigned philproctor Aug 10, 2023
raman-m pushed a commit to cezarypiatek/Ocelot that referenced this issue Aug 10, 2023
raman-m pushed a commit to cezarypiatek/Ocelot that referenced this issue Aug 10, 2023
@raman-m raman-m added the accepted Bug or feature would be accepted as a PR or is being worked on label Aug 10, 2023
@raman-m
Copy link
Member

raman-m commented Aug 10, 2023

The issue has been accepted due to ready PR #1353 :

All interested parties are welcome to review the code.
But the spec above is not final, the discussion can continue...

@mariotacke
Copy link
Author

Thanks all for finally addressing this. However, I must say I've moved on from this project since I filed this issue it in 2018. Going to un-assign myself.

@mariotacke mariotacke removed their assignment Aug 11, 2023
@raman-m raman-m self-assigned this Aug 18, 2023
@raman-m
Copy link
Member

raman-m commented Aug 18, 2023

@mariotacke commented on Aug 11:

Sad to hear that!
What gateway project has your team migrated to?

@raman-m raman-m changed the title Question: DownstreamHostAndPorts alias DownstreamHostAndPorts alias Jan 7, 2024
@raman-m
Copy link
Member

raman-m commented Nov 7, 2024

@NicoJuicy Welcome to #1353 (comment)

@raman-m
Copy link
Member

raman-m commented Nov 7, 2024

Hello everyone! Unfortunately, the previously linked PR #1353 has been closed.
I hope for more professional assistance from the Ocelot community...

@raman-m raman-m added proposal Proposal for a new functionality in Ocelot Configuration Ocelot feature: Configuration help wanted Not actively being worked on. If you plan to contribute, please drop a note. large effort Likely over a week of development effort medium effort Likely a few days of development effort and removed feature A new feature accepted Bug or feature would be accepted as a PR or is being worked on labels Nov 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Configuration Ocelot feature: Configuration help wanted Not actively being worked on. If you plan to contribute, please drop a note. large effort Likely over a week of development effort medium effort Likely a few days of development effort proposal Proposal for a new functionality in Ocelot
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants