0

I had a react js application (http://localhost:3000) that invoked a web api (http://xyz) POST method. The way i accomplished that is - through the "proxy":"http://xyz" setting in the package.json of the http://localhost:3000 react js application. When i moved the react js application comp to sitecore jss, the call isn't successful - xhr.js:155 GET http://new-jss-app.dev.local/sitecore/service/notfound.aspx?item=%2fapilist%2fsignin&user=extranet%5cAnonymous&site=new-jss-app

Any pointers to help accomplish the call? Thanks.....

0

Might help someone in the future. The call from the sc instance of JSS had request method: OPTION instead of POST (as in the call from the JSS connected local to the web API). So, modified the web API's web.config and global.asax to take care of the preflight request. this way got rid of the proxy setting in the react's package.json too.

https://navanblogs.blogspot.com/2019/09/create-cors-enabled-aspnet-webapi.html

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.