Skip to Content

Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource

Dear Experts,

We are creating a XS Project in Hana Studio and trying to consume SAP B1 Hana Service Layer as destination. But getting CORS error while login the application. We have tried all possible solutions available on blogs but not helping.

Here is the error and changes we did in XS project for CORS. "Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at https://XXXXX:50000/b1s/v1/Login. (Reason: CORS header ‘Access-Control-Allow-Origin’ missing)."

To Fix this i have added CORS in /use/sap/SapBusinessOne/ServiceLayer/conf/b1s “CorsEnable” : true “CorsAllowedOrigins”:”http://servername1:port1;http://servername2:port2“ Also i have added CORS headers in .xsaccess file "cors" : { "enabled" : true, "allowMethods":["GET","POST","HEAD","OPTIONS"], "allowOrigin":["*"], "allowCredential":true, "exposeHeaders": "access-control-allow-headers,access-control-allow-origin,access-control-expose-headers,authorization", "allowHeaders":"Origin, Content-Type, Depth, User-Agent, X-File-Size, X-Requested-With, If-Modified-Since, X-File-Name, Cache-Control", "maxAge":"3600" },

After all this changes still facing CORS issue.

Please help!!!!

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

0 Answers