@eclipsapp wrote:
Using
ionic emulate ios
, API requests are able to reach the API on my local machine just fine. However,ionic emulate ios -l -c
causes the app's API requests to reach the server in the form of preflight requests:
OPTIONS /api/user/get/profile_mob 200 1.68 ms
ionic.project
uses a proxy:"proxies": [ { "path": "/api", "proxyUrl": "https://dev.app.com/api" } ]
nginx.conf
below:location /api { add_header 'Access-Control-Allow-Origin' '*'; add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS, PUT, PATCH, DELETE'; add_header 'Access-Control-Allow-Credentials' 'true'; add_header 'Access-Control-Allow-Headers' 'X-Requested-With,content-type'; proxy_redirect off; proxy_http_version 1.1; proxy_set_header Host $http_host; proxy_set_header X-Scheme $scheme; proxy_set_header X-Real-IP $remote_addr; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "upgrade"; proxy_hide_header X-Powered-By; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_pass http://localhost:3003; }
From my readings, configuring the proxy and adding proxy should have fixed the problem. What else can I try? Any help would be appreciated.
Posts: 1
Participants: 1