my project create-react-app serves as the foreground, ssm serves as the background, and the foreground json is passed to the background through cross-domain means.
the setting of the proxy agent in package.json
"proxy": {
"/api/php": {
"target": "http://localhost:8080/shbaokangsoft-1.0.0-SNAPSHOT",
"ws": true,
"changeOrigin": true,
"pathRewrite": {
"^/api/php": ""
}
}
},
the foreground is not packed, and there is no problem when accessing the background.
the foreground is packaged and deployed using the serve-s command. As a result, the cross-domain proxy settings no longer seem to work, Json is no longer recognized, and whether the
is not comprehensive enough (whether the packages are all packaged with npm run build), or the cross-domain settings after packaging are not set as above.