Quantcast
Channel: Ionic Framework - Ionic Forum
Viewing all articles
Browse latest Browse all 48983

Which proxy configuration is the correct one?

$
0
0

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 :slight_smile:

  • Tarjei

1 post - 1 participant

Read full topic


Viewing all articles
Browse latest Browse all 48983

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>