亚洲国产日韩欧美一区二区三区,精品亚洲国产成人av在线,国产99视频精品免视看7,99国产精品久久久久久久成人热,欧美日韩亚洲国产综合乱

nginx reverse proxy not forwarding http requests?
天蓬老師
天蓬老師 2017-05-16 17:07:08
0
2
673

During the development stage, the front-end server is localhost:8080, and the back-end server is localhost:8088, which involves cross-domain, so nginx is used as a reverse proxy to convert all http requests starting with http://localhost:8080/api into http://localhost:8088/api, nginx configuration is as follows

The result is always 404

Use postman to test the backend interface and it shows normal

Check the task manager, nginx is running

nginx’s access log has no record, and there is no record in the error log. The following is the last content of the error log

I don’t know what went wrong

天蓬老師
天蓬老師

歡迎選擇我的課程,讓我們一起見(jiàn)證您的進(jìn)步~~

reply all(2)
曾經(jīng)蠟筆沒(méi)有小新

One missing /api

According to the request of the subject
Need to put http://localhost:8080/api => http://localhost:8088/api

But

location ^~ /api/ {
    proxy_pass http://localhost:8088/;
    ...
}

The implementation is http://localhost:8080/api => http://localhost:8088/http://localhost:8080/api => http://localhost:8088/
所以需要訪問(wèn) http://localhost:8080/api/apiSo you need to access http://localhost :8080/api/api to access the real endpoint.
Change to

location ^~ /api/ {
    proxy_pass http://localhost:8088/api;
    ...
}

That’s it

黃舟

Isn’t your server_name 127.0.0.1?
localhost不一定就代表127.0.0.1right?

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template