Home  >  Article  >  Web Front-end  >  How to set up proxy in uniapp

How to set up proxy in uniapp

coldplay.xixi
coldplay.xixiOriginal
2020-12-08 16:48:2117748browse

How to set up the proxy for uniapp: First open HbuilderX and find the [manifest.json] file; then find the configuration information of the h5 location, add the proxy configuration information; and finally restart the project.

How to set up proxy in uniapp

The operating environment of this tutorial: windows7 system, uni-app2.5.1 version, thinkpad t480 computer.

Recommended (free): uni-app development tutorial

Uniapp method to set up a proxy:

Open HbuilderX and find the manifest.json file, click on the source code view, as shown below:

How to set up proxy in uniapp

Find the configuration information of the h5 location and add the proxy configuration information. As follows:

Add proxy proxy configuration item content in devServer

"devServer" : {
"https" : false,
"proxy": {  
"/web": {  
"target": "http://dev.demo.com",
"changeOrigin": true,   
"secure": false,
"pathRewrite": {
"^/web": "/"  
}  
}  
}  
},

Then restart the project, it will be ok

Related free recommendations: Programming video courses

The above is the detailed content of How to set up proxy in uniapp. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn