cancel
Showing results for 
Search instead for 
Did you mean: 

Issues with Access-Control-Allow-Origin Header even after Disabling Web Security in Chrome

Former Member
0 Kudos

I have been working on the Getting Started Documents  on SAPUI5 Developer Guide section  and I must confess its been very helpful.

But I am stuck at the point where the demo app is meant to pull in data from an OData service as in the below code excerpt in my Component.js file

metadata : {

..........

config : {

            resourceBundle : "i18n/messageBundle.properties",

            serviceConfig : {

                name : "Northwind",

                serviceUrl : "http://services.odata.org/V2/(S(sapuidemotdg))/OData/OData.svc/"

            }

..........

}

The below error code are shown in my Google Chrome console even after disabling web security;

OPTIONS http://services.odata.org/V2/(S(sapuidemotdg))/OData/OData.svc/$metadata 501 (Not Implemented)

XMLHttpRequest cannot loadhttp://services.odata.org/V2/(S(sapuidemotdg))/OData/OData.svc/$metadata. No 'Issu' header is present on the requested resource. Origin 'http://localhost' is therefore not allowed access. The response had HTTP status code 501.

OPTIONS http://services.odata.org/V2/(S(sapuidemotdg))/OData/OData.svc/$metadata 501 (Not Implemented)

XMLHttpRequest cannot loadhttp://services.odata.org/V2/(S(sapuidemotdg))/OData/OData.svc/$metadata. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost' is therefore not allowed access. The response had HTTP status code 501.

Please how do I resolve this as there no suitable answers from the forum

Regards

wale Adeoye

Accepted Solutions (1)

Accepted Solutions (1)

Qualiture
Active Contributor
0 Kudos

Well, the message "No 'Access-Control-Allow-Origin' header is present on the requested resource" clearly indicates you have not disabled web security on your browser...

Which browser are you using, and how exactly did you try to allow CORS?

Former Member
0 Kudos

Hi Robin,

Thanks for your response. As indicated in the earlier post, I am using Google Chrome and I used --disable-web-security in other to disable web security on it.

Regards

Qualiture
Active Contributor
0 Kudos

I understand, but as I indicated the error message states that you haven't disabled it (correctly)

Have you closed all instances of Chrome before applying the parameter, and did you get the yellow bar on top of the browser stating "You are using an unsupported command-line flag"?

Former Member
0 Kudos

Ok, I did not get the yellow bar you just mentioned.

I only closed my chrome and even went as far as cleaning out all its processes in the windows task manager after applying the flag.

So probably, I did not include the command properly. Can you please direct me as to how it should be properly done.

Thanks

Former Member
0 Kudos

Below is a screenshot of how I have tried disabling web security this time around after closing out all instances of my chrome

jmoors
Active Contributor
0 Kudos

Disable web security should be enough, I've created shortcut with the following. However as Robin mentioned you need to make sure all chrome processes are closed.

C:\Users\xxxxxx\AppData\Local\Google\Chrome\Application\chrome.exe --disable-web-security

Regards,

Jason

Answers (2)

Answers (2)

Former Member
0 Kudos

This message was moderated.

Former Member
0 Kudos

So I got this sorted, thanks to @Robin van het Hof and @Jason Moors

In case, anybody has this same issues, Just follow the below procedure I used to solve mine on a Windows 7 PC

1. Make sure you close out all instances of Google Chrome including ending all its processes in the Windows Task Manager

2. Right-Click on your Google Chrome Icon, Copy the text in the Target: field without quotes - (in my case - C:\Program Files (x86)\Google\Chrome\Application\chrome.exe)

3 Open command prompt and paste the copied text and add --disable-web-security (in my case - cd C:\Program Files (x86)\Google\Chrome\Application\chrome.exe --disable-web-security)

You should then be up and running. Once Chrome starts, You will get a yellow bar at the top of the page indicating "You are using an unsupported command-line flag"

Hope this helps another newbie that maybe coming long.

Thanks all

Regards

Adewale Adeoye