vue reverse proxy

Scenario Description:

        Vue original package file is on the .net core project www folder go on release. This operation is no problem, but the company leadership let alone server deployment vue, front and back ends to be completely separated. Then on the problem this way, there is an upload address of the interface has been wrong, but later found turned out to be requested access ip address vue project. How to change not right.

try:

        Directly to the url desperate, but the background will verify whether the user is logged in, so write the results will be reported user is not logged in, the user is logged in fact, only the request header of the request does not carry the user's login information, resulting in an error.

the reason:

        I found that file upload component vue-uploader, but do not know why the request did not go through the ip address configuration of the production environment, the local test since vue have a built-in reverse proxy configurations, so not being given, but the files are not packaged support reverse proxy, when packaged, are they part of the code will not be packaged.

       This is ~~ This means that all interfaces to intercept requests, ip actual request is local 8003 port.

 

solution:

        This time the need to manually configure a reverse proxy to go up. Here we are using a reverse proxy Nginx to do. Location plus a port below the original listening, here's configuration Location / FileUpload, which means matching / FileUploadd interface, this interface if it is to reverse proxy to http://127.0.0.1:8003/FileUpload. This solved the problem.

 

Guess you like

Origin www.cnblogs.com/zhangjd/p/11227214.html
Recommended