Accessing Backends Through a Proxy
配置服务器可以通过 HTTP 或 HTTPS 代理访问 Git 或 Vault 后端。此行为通过 proxy.http
和 `proxy.https`下的设置针对 Git 或 Vault 进行控制。这些设置是针对每个存储库的,因此,如果您使用 composite environment repository,则必须单独为复合中的每个后端配置代理设置。如果使用需要针对 HTTP 和 HTTPS URL 使用单独代理服务器的网络,则可以为单个后端配置 HTTP 和 HTTPS 代理设置:在这种情况下,`http`访问将使用 `http`代理,而 `https`访问 `https`代理。此外,您还可以使用应用程序和代理之间的代理定义协议,为两种协议指定一个唯一代理。
The configuration server can access a Git or Vault backend through an HTTP or HTTPS proxy.
This behavior is controlled for either Git or Vault by settings under proxy.http
and proxy.https
.
These settings are per repository, so if you are using a composite environment repository you must configure proxy settings for each backend in the composite individually.
If using a network which requires separate proxy servers for HTTP and HTTPS URLs, you can configure both the HTTP and the HTTPS proxy settings for a single backend: in this case http
access will use http
proxy and https
access the https
one.
Also, you may specify one sole proxy that will be used for both protocols using the proxy definition protocol between application and proxy.
下表描述了 HTTP 和 HTTPS 代理的代理配置属性。所有这些属性都必须以 proxy.http
或 proxy.https
为前缀。
The following table describes the proxy configuration properties for both HTTP and HTTPS proxies. All of these properties must be prefixed by proxy.http
or proxy.https
.
Property Name | Remarks |
---|---|
host |
The host of the proxy. |
port |
The port with which to access the proxy. |
nonProxyHosts |
Any hosts which the configuration server should access outside the proxy. If values are provided for both |
username |
The username with which to authenticate to the proxy. If values are provided for both |
password |
The password with which to authenticate to the proxy. If values are provided for both |
以下配置使用 HTTPS 代理访问 Git 仓库。
The following configuration uses an HTTPS proxy to access a Git repository.
spring:
profiles:
active: git
cloud:
config:
server:
git:
uri: https://github.com/spring-cloud-samples/config-repo
proxy:
https:
host: my-proxy.host.io
password: myproxypassword
port: '3128'
username: myproxyusername
nonProxyHosts: example.com