Sunday, November 15, 2015

Creating CORS Web Service for AngularJS

CORS is the ability to allow cross domains scripting. This can be important if you say want to host your website on S3 and have those pages access web services in EC2. I spent TONS of time trying to find how to configure AngularJS to use CORS and what I generally saw was people saying...
"You need to configure the server side for access control, not the client."
Well that's not entirely true.

The example I am using is based on the Spring, Jersey, run-as-ajar example you can find on GitHub. So lets start with the server side then:

And here is the client side...

No comments: