on 01-21-2019 8:43 AM
Hello,
I followed this tutorial to create local proxy using node.js library. I got rid of the CORS problem, but I have another problem and it is this one:
I suspect that the problem is caused by defining the data source's uri like this:
"dataSources": {
"Z_ATTENDANCE_SRV": {
"uri": "localhost:8081/http://<address>:<port>/sap/opu/odata/SAP/Z_ATTENDANCE_SRV",
"type": "OData",
"settings": {
"odataVersion": "2.0",
"localUri": "localService/Z_ATTENDANCE_SRV/metadata.xml"
}
}
}
I think the problem is cause by "localhost:8081/" prefix in the URI, but I do not know how to get rid of the problem.
proxy.js:
var cors_proxy = require('cors-anywhere');
// Listen on a specific IP Address
// 0.0.0.0 equals localhost
var host = '0.0.0.0';
// Listen on a specific port, adjust if necessary
var port = 8081;
cors_proxy.createServer({
originWhitelist: [], // Allow all origins
requireHeader: ['origin', 'x-requested-with'],
removeHeaders: ['cookie', 'cookie2']
}).listen(port, host, function() {
console.log('Running CORS Anywhere on ' + host + ':' + port);
});
Do you have any suggestions?
The solution to this problem is to set port from which the app runs. I run the app in personal WebIDE so my port in 'proxy.js' file is '58513'. Also it is necessary to add 'http://' as a prefix to the data source uri. So my manifest looks like this:
"dataSources": {"Z_ATTENDANCE_SRV": {"uri": "http://localhost:58513/http://<address>:<port>/sap/opu/odata/SAP/Z_ATTENDANCE_SRV","type": "OData","settings": {"odataVersion": "2.0","localUri": "localService/Z_ATTENDANCE_SRV/metadata.xml"}}}
However, I come to another problem which is I get 403 status: Forbidden.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I have removed that line, but nothing changed. I also check transaction SU53 if I am not missing some authorizations but it is empty. I know I can get rid of CORS problem using reverse proxy on an appache server, but since I am using personal WebIDE, I have to export the app and install in on local appache server which is too time consuming. Do you know any other approach how to get rid of CORS proble on Personal WebIDE (I want to avoid --disable_security in chrome). Thanks.
User | Count |
---|---|
68 | |
9 | |
8 | |
7 | |
6 | |
5 | |
5 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.