etcd: etcd can't advertise URLs with paths, and therefore can't be run behind an HTTP proxy using location directives
In my application, I would like to run etcd
(particularly the peer URLs) behind an Nginx proxy. The primary reason I want to do this is that operators are already instructed to open port 443; I don’t want to require the opening of additional ports on my application. A secondary reason is to handle SSL termination and SSL mutual auth in Nginx, since there are more configuration options there.
Therefore, what I want to do is create location directives in nginx such as /etcd/client
and /etcd/peer
. Each of these locations will proxy to the local etcd instance which is listening 127.0.0.1 and the standard ports. For example:
location /etcd/peer {
if ($ssl_client_verify != SUCCESS) {
return 401;
}
rewrite /etcd/peer/(.*) /$1 break;
proxy_pass http://localhost:2380;
}
After configuring nginx, the next step is to start the etcd servers, each of which will advertise the Nginx URL, like so : --initial-advertise-peer-urls https://host-01.app/etcd/peer
.
Unfortunately, pkg/types/urls.go
does not permit URLs with paths. Therefore, my configuration is not accepted by etcd.
Is there a particular reason why advertise-peer-urls
is not allowed to contain a path?
About this issue
- Original URL
- State: closed
- Created 8 years ago
- Comments: 17 (8 by maintainers)
Hi, I’m sorry it was seven years ago - I don’t remember.