Skip to content
This repository has been archived by the owner on Jan 8, 2019. It is now read-only.

Service address does not allow url path or scheme #6

Open
dimitridaras opened this issue Sep 4, 2018 · 1 comment
Open

Service address does not allow url path or scheme #6

dimitridaras opened this issue Sep 4, 2018 · 1 comment
Labels
enhancement New feature or request help wanted Extra attention is needed

Comments

@dimitridaras
Copy link

dimitridaras commented Sep 4, 2018

Expected Behaviour

I should be able to specify a scheme and url path for a service address in consul, for instance

"address": "http://mydomain.com/MyService/",

This is valid consul configuration (although I appreciate that it might not be a common way of configuring consul), as we are using it in production at the moment.

Actual Behaviour

I get an error:

to use service Address: http://mydomain.com/MyService/ and Port: 80 as it is invalid. Address must contain host only e.g. localhost and port must be greater than 0

Steps to Reproduce the Problem

Register a service in consul with an address similar to above.
Register consul in ocelot, similar to below

{
    "ReRoutes": [
        {
            "DownstreamPathTemplate": "/MyService/{test}",
            "DownstreamScheme": "http",
            "UpstreamPathTemplate": "/{test}",
            "UpstreamHttpMethod": [ "GET" ],
            "ServiceName": "MyService",
            "LoadBalancerOptions": {
                "Type": "LeastConnection"
            },
            "UpstreamHeaderTransform": {
                "Accept": "application/json"
            }
        }
    ],
    "GlobalConfiguration": {
        "BaseUrl": "http://localhost:5000/",
        "ServiceDiscoveryProvider": {
            "Host": "localhost",
            "Port": 8500,
            "Type": "Consul"
        }
    }

Specifications

  • Version: 11.0.2
  • Platform: Windows
  • Subsystem: Ocelot.Provider.Consul

Thanks!

@TomPallister
Copy link
Member

@dimitridaras thanks for your interest in the project, I would suggest easiest way to get this would be fork Ocleot.Provider.Consul and make your change. Implementing it in Ocelot will be a faff because Ocelot only expects to get host and port from consul not the path / scheme. That would need some kind of change. I will leave this issue open and might get round to doing it one day.

@TomPallister TomPallister added enhancement New feature or request help wanted Extra attention is needed labels Sep 4, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants