Skip to Main Content

ORDS, SODA & JSON in the Database

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

CORS Error with Post from Angular

Joe the JetFeb 22 2019 — edited Feb 27 2019

Ok, we're running in standalone mode using ORDS, not APEX.

I got the Table REST enabled and I can delete and get, BUT, the insert (i.e. post) doesn't work. I get a CORS error.

Access to XMLHttpRequest at 'http://dbmachine:9090/ords/trex/heroes' from origin 'http://localhost:9075' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: Redirect is not allowed for a preflight request.

The Angular command that causes this is:

Const httpOptions = {

  headers: new HttpHeaders({'Content-Type': 'application/json',  'accept': 'application/json' , 'Access-Control-Allow-Origin': '*'})

  this.http.post<Hero>(this.heroesUrl, hero, httpOptions).subscribe();

I believe I have to change some settings in the Jetty Server running in the DB, but how do I do this?

This post has been answered by thatJeffSmith-Oracle on Feb 27 2019
Jump to Answer
Comments
Post Details
Added on Feb 22 2019
13 comments
1,864 views