報錯截圖如下:
#
XMLHttpRequest cannot load http://localhost:9090/services/user/login. Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:9000' is therefore not allowed access. The response had HTTP status code 403.
##反向代理程式配置如下:
#請問,配置哪裡出了問題?
过去多啦不再A梦2017-05-16 17:12:12
server_name 用 localhost 就好,不必帶端口,不然 http://localhost:9090/services/ 就轉送到 9000 端口了。配置其他部分應該沒毛病,提一點建議,nginx配置也貼代碼而不是圖片就好了,謝謝。
server {
listen 9090;
server_name localhost; // 修改这里
location /front/ {
proxy_pass http://127.0.0.1:9000/;
}
location /services/ {
proxy_pass http://127.0.0.1:8080/services/;
}
}
習慣沉默2017-05-16 17:12:12
根據錯誤提示,應該是你的 Apache 沒有 services/ 目錄的存取權限?
是不是專案路徑不在 Apache 預設路徑下,是的話要做對應的設定