customautosys commented on issue #850: URL: https://github.com/apache/cordova-android/issues/850#issuecomment-1501925408
> > Is there a way to route the AJAX requests through cordova-plugin-advanced-http and cordova-cookie-master? > > I'm not familiar with how these plugins work but you'll likely have to build your own abstraction. You might be able to overwrite the underlying `XMLHttpRequest` object on the browser to provide a different implementation that communicates with those plugins instead, but I'm not sure if that will work. Sometime native browser features aren't overwritable. It's possible you'd also have to overwrite the native `fetch` api as well, depending on what axios actually uses. > > > The problem is that we cannot always do a server side change. Some of us do not own the server we are targeting via CORS (e.g. scraping from another site). > > This can usually be worked around by having your own endpoint that you can control that proxies to the endpoint you want to target. CORS and cookies is a browser concept, so it only applies when using the browser's http features. So you'll need to configure your server accordingly for your clients, but the request from your own server to the target endpoint will not be restricted by CORS or Cookies SameSite policies. However, if the server you do not control have restrictive policies, it could be that they don't want you from hitting their endpoint(s) in the first place. I have solved my problem! https://github.com/customautosys/axios-cordova-adapter Also did a small bug fix to cordova-plugin-advanced-http: https://github.com/customautosys/cordova-plugin-advanced-http-redirect-fix https://github.com/silkimen/cordova-plugin-advanced-http/pull/501 -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
