Hi, I’ve been fiddling with my React Ionic(Ionic v 5.6.7) project trying to get it to proxy my backend server so I can avoid CORS issues.
My problem is that it seems that the proxies config in the ionic.config.json file seems not to cause any proxying. Here’s the relevant section in the file:
"proxies": [
{
"path": "/api",
"proxyUrl": "http://localhost:8000/api"
},
{
"path": "/login_app",
"proxyUrl": "http://localhost:8000/login_app"
}
]
This does not get triggered when I run yarn start
or ionic serve
.
What I did manage to get working was just setting the “proxy” field in the package.json
file, but I’m not sure if this is due to functionality within create-react-app
more than something that is ionic specific. Also, should it be possible to configure the proxy in the setupProxy.js file when working in dev?
Thanks for any input
- Tarjei
1 post - 1 participant