The vue project starts from local and changes to HTTPS protocol request

Generally, for a normal Vue project, the local localhost starts with the HTTP request protocol by default.

If the backend changes the http protocol to an https request, then our frontend also needs to make changes, otherwise the backend interface will report a 400 (bad resquest) error.

In fact, the front-end processing is also very simple:

   Find the vue.fonfig.js configuration file, change the proxy address to https, and then add a request configuration to enable https on the devServer, as shown in the figure below;

In this way, restart and run the project. At this time, the browser will report a prompt that it is not a secure connection. This does not matter. Click to continue and it will be ok.

Guess you like

Origin blog.csdn.net/weixin_43703816/article/details/125841573