第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定

nginx配置后,訪問不到后端,報(bào)404

nginx配置:

server{
???listen?80;
??????server_name?wj.com;
???location?/{
????????proxy_pass?http://localhost:8080/;
???????
????????add_header?Access-Control-Allow-Origin?$http_origin;
????????add_header?Access-Control-Allow-Methods?*;
????????add_header?Access-Control-Max-Age?3600;
????????add_header?Access-Control-Allow-Credentials?true;
????????add_header?Access-Control-Allow-Headers?$http_access_control_request_headers;
???????
????????if?($request_method?=?OPTIONS){
?????????return?200;
????????}
??????}
???}

client:

var?base?=?"http://wj.com/test";

nginx重載過。

https://img1.sycdn.imooc.com//5bf8c8150001f5e309480298.jpg

https://img1.sycdn.imooc.com//5bf8c8af00015b4b07090101.jpg

https://img1.sycdn.imooc.com//5bf8c8c5000174ae03950312.jpg




正在回答

3 回答

b.com:8888/test/get1

b.com:8888/test/get1

b.com后面加配置的監(jiān)聽端口號(hào)


0 回復(fù) 有任何疑惑可以回復(fù)我~

同樣的問題,樓主解決了嗎 嗚嗚

0 回復(fù) 有任何疑惑可以回復(fù)我~

這跟nginx有關(guān),即只有response code為以下value時(shí),才add the specified field:

Adds the specified field to a response header provided that the response code equals 200, 201, 204, 206, 301, 302, 303, 304, or 307. A value can contain variables.

也就是說你本身的接口返回了404,導(dǎo)致add_header沒有生效,你可以通過這樣設(shè)置來讓nginx始終添加:

add_header Access-Control-Allow-Origin $http_origin always;

0 回復(fù) 有任何疑惑可以回復(fù)我~
#1

慕工程255496 提問者

還是不行.(http://wj.com/test/postJson)訪問不到后端
2018-11-27 回復(fù) 有任何疑惑可以回復(fù)我~
#2

慕工程255496 提問者

http://wj.com/ 是可以看到(Welcome to nginx! If you see this page, the nginx web server is successfully installed and working. Further configuration is required. For online documentation and support please refer to nginx.org. Commercial support is available at nginx.com. Thank you for using nginx.)
2018-11-27 回復(fù) 有任何疑惑可以回復(fù)我~

舉報(bào)

0/150
提交
取消

nginx配置后,訪問不到后端,報(bào)404

我要回答 關(guān)注問題
微信客服

購課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)