-
Notifications
You must be signed in to change notification settings - Fork 86
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
[Bug]: Consul full Url is not considered due to UriBuilder and consul call fails #329
Comments
Hi @sreenath-guduru, Thanks for your report. To implement a test for it, we need to be able to run the test server under a path (not under a root domain). I'm not sure if that is possible with the vanilla Consul agent. I guess an external web server is necessary? Would you be able to find out how to prepare a test environment for your case? |
We setup an ingress to access consul from an app on an ec2 instance. Ingress
We are trying to hit the consul from the app on ec2 usign the path https://client.hostname.com/ci/consul-ingress |
Hi @marcin-krystianc , please check this response and let us know. |
I used Nginx to test this locally. I have a 'work in progress' branch (https://github.com/marcin-krystianc/consuldotnet/tree/dev-20240528-consul_paths), but since Consul.NET was not designed to work with a Consul URI under a subpath, it will take some time to finish it without breaking backward compatibility.
|
Great, Thank you for working on this and please keep us posted. And yes, I agree, it should work with root url (like http://localhost:8500/) and subpath too. If possible, can you please give us any ETA so that we can plan internally based on that. |
I'll do my best to fix in June (it may be sooner but I cannot promise that). |
Thanks @sreenath-guduru for your report, it's available in version https://www.nuget.org/packages/Consul/1.7.14.4 |
Thank you, @marcin-krystianc |
Describe the bug
When consul Url is like https://testconsul.com/details/sources, the consul keys load fails due to the way UrlBuilder is implemented.
Here ...
var builder = new UriBuilder(Client.Config.Address)
{
Path = url
};
If we pass on Client.Config.Address = https://testconsul.com/details/sources, based on UriBuilder working model, it takes host and considers only https://testconsul.com.
So, in order to consider this whole Url, it should be something like this. OR may be expose interface to provide custom UriBuilder by consumers?
UriBuilder builder = new UriBuilder
{
Scheme = uri.Scheme,
Host = uri.Host,
Path = uri.AbsolutePath + url (which is input in that function),
Query = uri.Query,
Port = uri.Port
};
This only works if consul uri is root domain like http://consultest.com:9999 or something like this.
Appreciate if this issue is considered for fix.
If there are any config options in this package to handle this situation, that also would be fine if shared.
Steps To Reproduce
Expected behavior
Even when Consul Uri is with added path like https://testconsul.com/details/sources, it should work to pull keys
Environment
Logs
No response
Additional context
No response
The text was updated successfully, but these errors were encountered: