我的问题
我正在作为反向代理的 nginx 后面建立一个基于 jhipster 的微服务基础设施。
grafana 或 kibana 等其他组件允许配置 aserver_root_url
或a- 以在orserver_basepath
下访问它们。我正在努力对 eureka-cloud-config-registry 部分做同样的事情。example.com/grafana
example.com/kibana
如果我通过 nginx 上的每个请求转发到注册表/registry
,不幸的是注册表中有链接,例如/api/routes
- 在我的情况下,这些链接会转到“运行”下的网关,/
因此无法工作。
到目前为止我发现了什么
我知道这个组件基于 Spring Boot 1.5.9 - 它有一个配置选项server.context-path
,我可以设置(见(1)
下文)/registry
不幸的是,当我想访问时,localhost:8761/registry
我得到一个 HTTP 401 Unauthorized 错误,我试图通过添加security.ignored
(见(2)
下文),没有任何运气。
我的配置
这就是我的jhipster-registry.yml
样子:
version: '2'
services:
jhipster-registry:
image: jhipster/jhipster-registry:v3.2.4
volumes:
- ./central-server-config:/central-config
# By default the JHipster Registry runs with the "dev" and "native"
# Spring profiles.
# "native" profile means the filesystem is used to store data, see
# http://cloud.spring.io/spring-cloud-config/spring-cloud-config.html
environment:
- SPRING_PROFILES_ACTIVE=dev,native
- SECURITY_USER_PASSWORD=admin
- JHIPSTER_REGISTRY_PASSWORD=admin
- JHIPSTER_LOGGING_LOGSTASH_ENABLED=false
- JHIPSTER_METRICS_LOGS_ENABLED=false
- SERVER_SERVLET_PATH=/registry # (1)
- SECURITY_IGNORED=/**,/registry # (2)
ports: #docker-host:docker-container
- 8761:8761
我运行这个使用docker-compose -f jhipster-registry.yml up jhipster-registry