In order to prevent cross domain problems when requesting interfaces, vite proxy is used for configuration.
For example, the address of the request interface is https://172.1.1.0:8080 , the vite configuration information is as follows:
...
server: {
host: '0.0.0.0',
port: 12000,
proxy: {
'/local/': {
target: 'https://172.1.1.0:8080',
changeOrigin: true,
rewrite: (path) => path.replace(/^\/local\//, ''),
},
},
},
...
Local requests are all interfaces. You only need to add a prefix -/local /. For example, the login interface is’/local/Login ‘.
So I went to request and found that the error was reported directly. The error information is as follows:
[vite] http proxy error: Error: self signed certificate
The certificate is wrong.
Solution: add a configuration – secure: false The overall configuration code is as follows:
proxy: {
'/local/': {
target: '',
// Add
secure: false,
// End
changeOrigin: true,
rewrite: (path) => path.replace(/^\/local\//, ''),
},
},
Then try again. Sure enough, there’s no problem.
Read More:
- [Solved] Error response from daemon: Get “*“: x509: certificate signed by unknown authority
- Docker Pull Error: certificate signed by unknown authority
- git submodule add Error: SSL certificate problem unable to get local issuer certificate
- [Solved] svn Error: E230001: Server SSL certificate verification failed: certificate issued
- [Solved] Postman Error: SSL Error: Self signed certificate Disable SSL Verification
- SVN Error:svn: E230001: Server SSL certificate verification failed: certificate issued
- Mac IDEA Connect SVN Error: E230001: Server SSL certificate verification failed: certificate issued
- [Solved] Git Clone Error: error setting certificate verify locations
- [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed [Solved]
- Repo init Error: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed
- [Solved] ngrok 1.7 Build Error: remote error: tls: bad certificate
- [Solved] Android HTTPS request resource or interface error: server certificate
- [Solved] Vite Project jenkins Auto Package Error: failed to load config from ../vite.config.js You installed esbuild on
- How to Solve npm Error: unable to get local issuer certificate
- [Solved] But was actually of type ‘com. Sun. Proxy. $proxy**‘
- [Solved] Rancher Add User Error: x509: certificate has expired Internal error occurred: failed calling webhook “rancherauth.cattle.io”:
- [Solved] Synergy Error: ERROR: ssl certificate doesn‘t exist
- [Solved] Nginx Certificate Fill Path Error: SSL: error:0200107B:system library:fopen:Unknown error:fopen
- Docker Error response from daemon: Get https://registry-1.docker.io/v2/: x509: certificate has expired or is not yet valid
- [Solved] Vite Bulk Import import.meta.glob Error: ERR_ABORTED 403 (Forbidden)