我有一個設置(微服務),其中 Zuul 網關(localhost)位于使用 uWSGI 服務的 Flask REST API 應用程序(localhost:8080)前面。當我嘗試通過網關訪問 API 時(例如curl http://localhost/api/endpoint),所有其他請求都會失?。℉TTP 500)。API 端沒有日志,以下是非常密集的網關異常日志的摘錄:com.netflix.zuul.exception.ZuulException: Forwarding error...Caused by: com.netflix.client.ClientException: null...Caused by: java.lang.RuntimeException: org.apache.http.NoHttpResponseException: localhost:8080 failed to respond不過,當我直接訪問 API時(例如),它工作得很好(每個請求都按預期處理)。curl http://localhost:8080/api/endpoint另一個有趣的事情是,如果使用 Flask 的開發服務器而不是 uWSGI,當我嘗試通過網關訪問 API 時,它會起作用。這是我的 uWSGI 設置:[uwsgi]wsgi-file = api.pycallable = appuid = apigid = apimaster = trueprocesses = 2threads = 2http-timeout = 300socket-timeout = 300harakiri = 300http = 0.0.0.0:8080socket = /tmp/uwsgi.socketchmod-sock = 664vacuum = truedie-on-term = truewsgi-disable-file-wrapper = truelog-date = %%Y-%%m-%%d %%H:%%M:%%Slogformat-strftime = truelogformat = %(ftime) | uWSGI | %(addr) (%(proto) %(status)) | %(method) %(uri) | %(pid):%(wid) | Returned %(size) bytes in %(msecs) ms to %(uagent)版本是spring-cloud-netflix-zuul-2.1.1.RELEASE.jar和uwsgi==2.0.17.1。Wireshark 檢查顯示TCP 8080 -> 80 [RST] Seq=123 Win=0 Len=0知道這里可能有什么問題嗎?
1 回答

忽然笑
TA貢獻1806條經驗 獲得超5個贊
通過將 NGINX 置于 uWSGI 之上來解決。
NGINX 監聽端口 8080 并通過 unix 套接字與 uWSGI 對話,因此從 Zuul 的角度來看,沒有任何變化。
添加回答
舉報
0/150
提交
取消