0

我正在本地 bosh-lite 设置中试验 CF。如果运行良好,我部署到的应用程序。我现在正在尝试按照此处的步骤 https://github.com/cf-platform-eng/cf-community-workshop/blob/master/demos/service-broker-lab.adoc 尝试自定义服务代理设置.

https://github.com/mstine/haash-broker应用程序启动并运行良好:

$ cf apps
name            requested state   instances   memory   disk   urls
haash-broker    started           1/1         768M     1G     haash-broker.vbox.mojito, haash-broker.192.168.50.6.xip.io

我可以从我的主机浏览器很好地访问它:http: //haash-broker.192.168.50.6.xip.io/v2/catalog

但是当我执行

cf create-service-broker haash-broker warreng natedogg http://haash-broker.192.168.50.6.xip.io

我明白了

$ cf create-service-broker haash-broker warreng natedogg http://haash-broker.192.168.50.6.xip.io
Creating service broker haash-broker as admin...
FAILED
Server error, status code: 502, error code: 10001, message: The service broker could not be reached: http://haash-broker.192.168.50.6.xip.io/v2/catalog

当我登录到 CC VM 时:

$ bosh -e vbox -f cf ssh api/eb4cec99-bab1-4513-a980-fb92775ac2d8

我可以ping主机名:

api/eb4cec99-bab1-4513-a980-fb92775ac2d8:~$ sudo ping haash-broker.192.168.50.6.xip.io
PING haash-broker.192.168.50.6.xip.io (192.168.50.6) 56(84) bytes of data.
64 bytes from 192.168.50.6: icmp_seq=1 ttl=64 time=0.080 ms

但是 wget 连接被拒绝:

api/eb4cec99-bab1-4513-a980-fb92775ac2d8:~$ wget http://warreng:natedogg@haash-broker.192.168.50.6.xip.io/v2/catalog
--2018-04-06 04:19:05--  http://warreng:*password*@haash-broker.192.168.50.6.xip.io/v2/catalog
Resolving haash-broker.192.168.50.6.xip.io (haash-broker.192.168.50.6.xip.io)... 192.168.50.6
Connecting to haash-broker.192.168.50.6.xip.io (haash-broker.192.168.50.6.xip.io)|192.168.50.6|:80... failed: Connection refused.

防火墙允许该 VM 上的所有内容 ( sudo iptables -L)。主机名得到正确解析。ping 正常,并且目标 IP 上的 80 端口是打开的,因为我可以从我的主机浏览器访问它。

wget 怎么可能在这种情况下不起作用?这似乎也是我未能创建服务代理的原因cf create-service-broker

更新

我已经设法使用在我的 bosh-lite 环境之外运行的 nginx 反向代理的 URL 执行 cf create-service-broker 命令。代理重定向到相同的初始 URL http://haash-broker.192.168.50.6.xip.io 并且命令以这种方式成功。但随后

cf create-service-broker haash-broker warreng natedogg http://haash-broker.192.168.50.1.xip.io:9999
cf enable-service-access haash
cf create-service HaaSh basic my-hash

(其中 haash-broker.192.168.50.1.xip.io:9999 是我的 nginx 代理)失败

Server error, status code: 502, error code: 10001, message: The service broker rejected the request to http://haash-broker.192.168.50.1.xip.io:9999/v2/service_instances/4ef19154-d238-4cb3-8003-803fba53af3f?accepts_incomplete=true. Status Code: 400 Bad Request, Body: {"timestamp":1523008856993,"error":"Bad Request","status":400,"message":""}

我可以在 nginx 和代理应用程序日志中看到请求到达代理并以 400 回答。现在调试原因。

4

1 回答 1

0

你可以发布--server-response选项使用的结果wget吗?当您尝试curl经纪人时会发生什么?

Broker 需要凭据,但如果它在第一个wget没有凭据的请求上响应 401 或 500 会很有趣。

于 2018-04-06T09:56:04.260 回答