on 02-06-2013 12:28 PM
Hi all,
When i developed a sap mobile app with sencha touch using odata proxy. i faced the problem of same origin policy, starting google chrome with disable web
security i can run my app. but i want a solution neiter than disable chrome web security, for example a reverse proxy ?
Waiting for your help ?
Regards Tarik,
Hi Tarik,
Try using Ajax call in your sencha code.Some times XMLHttpRequests will cause problems.
Sample code:
Ext.Ajax.request({
headers : {
'Content-Type': 'application/atom+xml',
},
url :myFirstURL,
method : 'POST',
xmlData :myBody,
disableCaching: true,
success : function(response,opts) {
},
failure : function(response,opts) {
}
This code is working for me without disabling web security in chrome.
I think the problem is because of some Chrome restrictions to access few .JS files of our code. Few changes in manifest file may also resolve this issue.
Kindly let me know if you have any issues.
Regards
Buddha Puneeth
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello,
Thanks for your Reply!
I resolved the problem by enabling mod_proxy module of apache2, we can configure apache in reverse proxy mode. In reverse proxy mode, apache2 appears be like an ordinary web server to the browser. However depending upon the proxy rules defined, apache2 can make cross-domain request and serve data back to the browser.
To enable apache mod_proxy, we have to add the following lines to httpd.conf :
LoadModule proxy_module modules/mod_proxy.so
LoadModule proxy_http_module modules/mod_proxy_http.so
LoadModule rewrite_module modules/mod_rewrite.so
ProxyRequests Off
RewriteEngine on
<Proxy>
Order deny,allow
Allow from all
</Proxy>
ProxyPass /call/ http://your.distant.webservice
ProxyPassReverse /call/ http://your.distant.webservice
ProxyPassReverse /cal/
Finally, to run the web service in apache proxy, you have juste access to localhost/call/, so there is any more the same origin problem
Thanks and best Regards
Tarik
User | Count |
---|---|
86 | |
10 | |
10 | |
9 | |
7 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.