I have an Ionic PWA, so it runs in browser. I'm trying to send requests to my symfony backend. At first I had everything installed on my local pc and the requests were working with an ionic proxy. Now I have installed both applications on a server. At first I have tried to use the url from the backend without proxy. Then there was a CORS error. Then I wrote a .htaccess file for the backend with the following input:
Header add Access-Control-Allow-Origin "\*"
Header add Access-Control-Allow-Methods: "GET,POST,OPTIONS,DELETE,PUT"
Now I'm getting this:
XMLHttpRequest cannot load ... Response for preflight has invalid HTTP status code 405
If I set a proxy as before on the local installation like this:
"proxies": [
{
"path": "/api",
"proxyUrl": "http://api.example.com/api"
}
]
I'm getting a 404 not found error, when I try to send a request to http://app.example.com/api
Can someone tell me how it will work correctly when frontend and backend are on a server and the app runs in the browser?