mraible / boot-ionic

An example mobile app written with Ionic Framework
36 stars 16 forks source link

same or different server ? #3

Open bayboraoren opened 9 years ago

bayboraoren commented 9 years ago

can it run different servers ? ionic -> server A spring backend -> server B

mraible commented 9 years ago

Yes, you can do this. However, you'll need to modify the Spring application so it has a filter that sets headers to bypasses SOP rules. See my OptionsHeadersFilter in the following blog post for an example:

https://raibledesigns.com/rd/entry/implementing_ajax_authentication_using_jquery

bayboraoren commented 9 years ago

I had ..

response.setHeader("Access-Control-Allow-Origin", "*"); response.setHeader("Access-Control-Allow-Methods", "POST, GET, OPTIONS, DELETE, PUT,PATCH"); response.setHeader("Access-Control-Max-Age", "3600"); response.setHeader("Access-Control-Allow-Headers", "Origin, X-Requested-With, Content-Type, Accept");

response

Remote Address:127.0.0.1:9000 Request URL:http://localhost:9000/authenticate Request Method:OPTIONS Status Code:200 OK

but nothing to authenticate

mraible commented 9 years ago

I don't have time to look into this right now, I'm flying out of town on vacation in a few hours. I'd suggest searching/posting on Stack Overflow. Please let me know if you don't have it solved by Monday (when I'm back from vacation) and I can whip up an example.