Win a copy of Microservices in Action this week in the Web Services forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Devaka Cooray
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Knute Snortum
  • Junilu Lacar
  • paul wheaton
Saloon Keepers:
  • Ganesh Patekar
  • Frits Walraven
  • Tim Moores
  • Ron McLeod
  • Carey Brown
Bartenders:
  • Stephan van Hulst
  • salvin francis
  • Tim Holloway

forbidden message for Spring REST POST request with ACCESS_CONTROL_ALLOW_ORIGIN set to allow all  RSS feed

 
Ranch Hand
Posts: 1021
2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a spring REST POST web service with cross origin headers set as below:

However I get message saying forbidden when sending POST request from browser.The post request works fine from postman or Apache Rest Client.






thanks
 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
As far as I know its not your rest service code its your server which is creating problem here. If server is not allowing ACCESS_CONTROL_ALLOW_ORIGIN then setting it in code will not work.

Which serve you are using and which API ?

One more point no days browsers are not supporting Cross-Origin Resource Sharing. Please check this link

https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS

It says clients will not be allowed to gain resource access if it exists on other domain.

 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!