Sent from my LG Mobile
>--
>You received this message because you are subscribed to the Google Groups "AngularJS" group.
>To unsubscribe from this group and stop receiving emails from it, send an email to angular+u...@googlegroups.com.
>To post to this group, send email to ang...@googlegroups.com.
>Visit this group at http://groups.google.com/group/angular.
>For more options, visit https://groups.google.com/groups/opt_out.
>
>
Sent from my LG Mobile
James Allanson <j...@jimallanson.com> wrote:
>It sounds like you need to configure your server to respond to pre-flight requests (the OPTIONS method). There's a node package for using CORS with Express, which looks pretty simple to use.
>
>https://npmjs.org/package/cors#enabling-cors-pre-flight
>
Have you added a handler for the OPTIONS verb? Something like this:
https://gist.github.com/JimAllanson/d7056f202125dbc1ed8c
On Tuesday, 13 August 2013 16:46:07 UTC+1, john tigernassau wrote:Added OPTIONS but still does not work (:Sent from my LG Mobile
Jose Luis Rivas <ghost...@gmail.com> wrote:
>On 8/12/13 6:14 PM, john tigernassau wrote:
>> our rest server works with CURL, not with Angular http. Any help
>> appreciated
>>
>> We've tried every CORS option we can find but angular still reports an
>> error with different origin
>>
>> Node Express running on port 3026:
>>
>> app.post('/api/account', function(req,res) {
>> //res.header("Access-Control-Allow-Origin","http://localhost:3025");
>> res.header("Access-Control-Allow-Origin","*");
>> res.header("Access-Control-Allow-Headers","X-Requested-With");
>> res.header("Access-Control-Allow-Methods","GET, POST");
>> ....
>
>In that last line, add "OPTIONS" to the list of methods.
>
>
>--
--
You received this message because you are subscribed to the Google Groups "AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email to angular+u...@googlegroups.com.
To post to this group, send email to ang...@googlegroups.com.
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/groups/opt_out.
--
You received this message because you are subscribed to a topic in the Google Groups "AngularJS" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/angular/z7cVEI-Jo3s/unsubscribe.
To unsubscribe from this group and all its topics, send an email to angular+u...@googlegroups.com.
Could not get plunker to display on laptop running chrome on debian and really screwy on my mobile android - any chance you could post angular code on forum or gist or jsfiddle? Thks - will try to slay this CORS beast
Sent from my LG Mobile
Jim Allanson <j...@jimallanson.com> wrote:
>>>> >> //res.header("Access-Control-**Allow-Origin","http://**
>>>> localhost:3025 <http://localhost:3025>");
>>>> >> res.header("Access-Control-**Allow-Origin","*");
>>>> >> res.header("Access-Control-**Allow-Headers","X-Requested-**With");
>>>> >> res.header("Access-Control-**Allow-Methods","GET, POST");
>>>> >> ....
>>>> >
>>>> >In that last line, add "OPTIONS" to the list of methods.
>>>> >
>>>> >
>>>> >--
>>>>
>>>
>>> Luis, James
>>> thks for your suggestions.
>>>
>>> arrrgh, still no go even trying the restify option suggestions - here's
>>> the core of what we have been trying
>>> 1) should the allowed header options be in an array [] ?
>>> 2) would we want options like "authorization" when there isn't any
>>> corresponding call in our angular http setup ?
>>> 3) with Curl, the only header was for application/json - shouldn't that
>>> be the only header option required ?
>>>
>>> Does angular really work with REST with the api on another server / port
>>> ?
>>>
>>> express:
>>> res.header('Access-Control-Allow-Credentials'),true;
>>>
>>> //res.header("Access-Control-Allow-Origin","http://localhost:3025"<http://localhost:3025>
>>> );
>>> res.header('Access-Control-Allow-Origin','*');
>>> //res.header("Access-Control-Allow-Headers","X-Requested-With");
>>>
>>> res.header('Access-Control-Allow-Methods','GET,HEAD,PUT,POST,DELETE,OPTIONS');
>>> res.header('Access-Control-Allow-Headers',
>>>
>>> ['Accept','Accept-Version','Content-Type','Api-Version','Authorization']);
>>>
>>> angular:
>>>
>>> method : 'POST',
>>> url : resturl,
>>> data : $scope.user,
>>> headers: {'Content-Type':'application/json'}
>>>
>>>
>>> --
>>> You received this message because you are subscribed to the Google Groups
>>> "AngularJS" group.
>>> To unsubscribe from this group and stop receiving emails from it, send an
>>> email to angular+u...@googlegroups.com.
>>>
>>> To post to this group, send email to ang...@googlegroups.com.
>>> Visit this group at http://groups.google.com/group/angular.
>>> For more options, visit https://groups.google.com/groups/opt_out.
>>>
>>>
>>>
>>
>>
>>
>> --
>> -Joseph Curtin
>> http://www.jbcurtin.com
>> <http://www.jbcurtin.com>github <http://goo.gl/d5uPH>
>> @jbcurtin
>> **
>>
>> --
>> You received this message because you are subscribed to a topic in the
>> Google Groups "AngularJS" group.
>> To unsubscribe from this topic, visit
>> https://groups.google.com/d/topic/angular/z7cVEI-Jo3s/unsubscribe.
>> To unsubscribe from this group and all its topics, send an email to
>> angular+u...@googlegroups.com.
>> To post to this group, send email to ang...@googlegroups.com.
>> Visit this group at http://groups.google.com/group/angular.
>> For more options, visit https://groups.google.com/groups/opt_out.
>>
>>
>>
>
$http({
method : 'POST',
url : 'http://localhost:3000/',
data : {'hello': 'world'},
headers: {'Content-Type':'application/json'}
}).then(
function(response){
$scope.response = response;
})
We are ruuning ang 1.15. Node .10.12, chromium on debian - will test on firefox - what browser and os are you running -
Sent from my LG Mobile
James Allanson <j...@jimallanson.com> wrote:
>Sure - the Angular code was just a basic $http, I think I copied it from
>your example:
>
> $http({
>> method : 'POST',
>> url : 'http://localhost:3000/',
>> data : {'hello': 'world'},
>> headers: {'Content-Type':'application/json'}
>> }).then(
>> function(response){
>> $scope.response = response;
>> })
>
>
>On Wednesday, 14 August 2013 18:26:30 UTC+1, john tigernassau wrote:
>>
>> @James
>> Thks for sample - did not.know about express app.options
>>
>> Could not get plunker to display on laptop running chrome on debian and
>> really screwy on my mobile android - any chance you could post angular code
>> on forum or gist or jsfiddle? Thks - will try to slay this CORS beast
>>
>> Sent from my LG Mobile
>>
>> Jim Allanson <j...@jimallanson.com <javascript:>> wrote:
>>
>> >These work for me:
>> >
>> >Server
>> >https://gist.github.com/JimAllanson/e6c0de248e6e7142e26c
>> >
>> >Client:
>> >http://plnkr.co/edit/kJzhRFiU9rHiXEUpxDoN?p=preview
>> >
>> >
>> >On 13 August 2013 23:24, Joseph Curtin <joseph...@gmail.com <javascript:>>
>> wrote:
>> >
>> >> Maybe I missed this data already, but can you submit an example of your
>> >> request? What it looks like on a network panel or the result of a curl
>> with
>> >> a request/response headerdump.
>> >>
>> >> Cheers,
>> >>
>> >>
>> >> On Tue, Aug 13, 2013 at 5:17 PM, john.tiger <john.tig...@gmail.com<javascript:>
>> >>> email to angular+u...@googlegroups.com <javascript:>.
>> >>>
>> >>> To post to this group, send email to ang...@googlegroups.com<javascript:>
>> .
>> >>> Visit this group at http://groups.google.com/group/angular.
>> >>> For more options, visit https://groups.google.com/groups/opt_out.
>> >>>
>> >>>
>> >>>
>> >>
>> >>
>> >>
>> >> --
>> >> -Joseph Curtin
>> >> http://www.jbcurtin.com
>> >> <http://www.jbcurtin.com>github <http://goo.gl/d5uPH>
>> >> @jbcurtin
>> >> **
>> >>
>> >> --
>> >> You received this message because you are subscribed to a topic in the
>> >> Google Groups "AngularJS" group.
>> >> To unsubscribe from this topic, visit
>> >> https://groups.google.com/d/topic/angular/z7cVEI-Jo3s/unsubscribe.
>> >> To unsubscribe from this group and all its topics, send an email to
>> >> angular+u...@googlegroups.com <javascript:>.
>> >> To post to this group, send email to ang...@googlegroups.com<javascript:>
>> .
>> >> Visit this group at http://groups.google.com/group/angular.
>> >> For more options, visit https://groups.google.com/groups/opt_out.
>> >>
>> >>
>> >>
>> >
>> >--
>> >You received this message because you are subscribed to the Google Groups
>> "AngularJS" group.
>> >To unsubscribe from this group and stop receiving emails from it, send an
>> email to angular+u...@googlegroups.com <javascript:>.
>> >To post to this group, send email to ang...@googlegroups.com<javascript:>
I tested it on Chrome (latest) for Windows. I'll try to take a look from a Debian environment later, I'm on a train at the moment. You might want to try using a debugging proxy like Charles or Fiddler to get a full log of the requests and responses - if you can post these it might help narrow it down.
To unsubscribe from this group and all its topics, send an email to angular+u...@googlegroups.com.
You must be doing something wrong there. have been using a very similar stack and had no issues. And your problem is not in the angular side but server so dont waste your time debugging on plunkr. Check on goohle for express cors
Pls stop saying angular is fine - already there have been diferences in whether defaults headers are included or not depending on version or docs. cors is tricky between server, browsers, and angular. Before you make definite statements tests need to be run and indicate what os, what browser, what server, and what version of angular
Sent from my LG Mobile
findesk <mi...@pohlschmidt.com> wrote:
>What port are you running your server on?
>
>In your original question, you indicate curl worked when hitting port *8026*
>.
>
> curl -i -X POST http://localhost:*8026*/api/account -d
>'{"accountname":"test",
>
>But in Angular your 'resturl' is pointing at *3026*.
>
> var resturl = 'http://localhost:*3026*/api/account';
>
>CORS works just fine with Angular. It's a server issue not an angular issue.
>
>>
>
We've got CORS working with Angular 1.1.5 for IE8+, Chrome, Firefox and Safari (using a Java based backend) - aside from IE support, the only issue we've run in to so far was with the preflight request (which is why I suggested looking into this first).
I'd definitely recommend that you install Charles (http://www.charlesproxy.com/) or Fiddler if you prefer, and post a copy of the logs here - it'll make it much easier for us to understand exactly what's happening.
We've got CORS working with Angular 1.1.5 for IE8+, Chrome, Firefox and Safari (using a Java based backend) - aside from IE support, the only issue we've run in to so far was with the preflight request (which is why I suggested looking into this first).
I'd definitely recommend that you install Charles (http://www.charlesproxy.com/) or Fiddler if you prefer, and post a copy of the logs here - it'll make it much easier for us to understand exactly what's happening.
On Thursday, 15 August 2013 16:50:15 UTC+1, john tigernassau wrote:Just a bad post from using 3026 on one test machine snd 8026 on anotherPls stop saying angular is fine - already there have been diferences in whether defaults headers are included or not depending on version or docs. cors is tricky between server, browsers, and angular. Before you make definite statements tests need to be run and indicate what os, what browser, what server, and what version of angular
Sent from my LG Mobile
findesk <mi...@pohlschmidt.com> wrote:
>What port are you running your server on?
>
>In your original question, you indicate curl worked when hitting port *8026*
>.
>
> curl -i -X POST http://localhost:*8026*/api/account -d
>'{"accountname":"test",
>
>But in Angular your 'resturl' is pointing at *3026*.
>
> var resturl = 'http://localhost:*3026*/api/account';
>
>CORS works just fine with Angular. It's a server issue not an angular issue.
>
>>
>
>--
--
You received this message because you are subscribed to the Google Groups "AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email to angular+u...@googlegroups.com.
To post to this group, send email to ang...@googlegroups.com.
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/groups/opt_out.
Okay further digging with mozilla mdn shows our previous apps work since we were sending data as urlencoded which they say does not invoke pre-flight - they also say options must precede post, ... but don't give example of that
So maybe 2 options are
1. Stringify json and send as urlencoded then convert back to json on server with maybe toJSON
2. Figure out how to get options preceding post but we have tried all types of exprrss suggestions with zero success
Anyone else sending json as urlencoded?
Sent from my LG Mobile
AJ Mercer <ajme...@gmail.com> wrote:
>*AJ Mercer*
><webonix:net strength="Industrial" /> <http://webonix.net> | <webonix:org
>community="Open" /> <http://webonix.org>
>http://twitter.com/webonix
>Railo Community Manager <http://www.getrailo.org/index.cfm/community/team/>
As AJ says, the options request is handled by the browser automatically, you don't need anything extra on the client side for this.
The 404 responses are what I'd expect to see when the server isn't configured to respond to options requests - could you give us more details of what happens if you leave the call to app.options in? Since the only change is on the server side, I'd still expect to see requests being made before it hangs. Also, could you describe the hanging behaviour in more detail for us? Does it seem like a JS error or something else?
Since you mentioned that you're only working with open source software, is your app itself open source? If so, seeing the full source code would help.
You received this message because you are subscribed to a topic in the Google Groups "AngularJS" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/angular/z7cVEI-Jo3s/unsubscribe.
To unsubscribe from this group and all its topics, send an email to angular+u...@googlegroups.com.
As AJ says, the options request is handled by the browser automatically, you don't need anything extra on the client side for this.
The 404 responses are what I'd expect to see when the server isn't configured to respond to options requests - could you give us more details of what happens if you leave the call to app.options in? Since the only change is on the server side, I'd still expect to see requests being made before it hangs. Also, could you describe the hanging behaviour in more detail for us? Does it seem like a JS error or something else?
--
You received this message because you are subscribed to the Google Groups "AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email to angular+u...@googlegroups.com.
To post to this group, send email to ang...@googlegroups.com.
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.