UI5 TDG Demo – CORS Error – Alternative Solution
You are working on TDG Demo provided in UI5 developer guide. Your application fails to load data from sample OData service due to web security / CORS Cross-origin resource sharing (CORS).
As per sap help documentation , you should over come this issue by using simple proxy servlet with additional context param as mentioned at this link. But, sometime this may not work due to some unknown reasons.
Below is the alternative solution to overcome this issue.
HTTP Status 500 – Server redirected too many times (20)
Solution: Use CORSPROXY
1. Install CORSPROXY by giving below command at command or $ prompt
npm install -g corsproxy
2. Start CORSPROXY by giving below command at command prompt
3. This starts corsproxy in it’s default port 9292. You can launch it by http://localhost:9292
4. Now, you can use your ODATA service url by appending it to corsproxy url
will be called by below url
You can test it by launching directly.
5. Now use this new url in component.js. Run UI5 TDG Demo app and you should see list of products from odata service.