CORS issue with angularness and post, cont.

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

CORS issue with angularness and post, cont.

Robert Ernens-3
In addition to my previous message and maybe to help diagnose where the
problem lies, here are the request info as parsed by active 4D

Request Info
Key Value
*ajax False
*doctype "html"
*host "glctracker.golf-loisir-club.com"
*host address "37.187.129.224"
*host port "80"
*http version "1.1"
*remote address "78.225.31.134"
*request method "POST"
*secure "0"
*virtual host ""
Accept "application/json, text/plain, */*"
Accept-Encoding "gzip,deflate"
Accept-Language "fr-FR,fr;q=0.8,en-US;q=0.6,en;q=0.4"
Cache-Control "no-cache"
Connection "keep-alive"
Content-Length "45"
Content-Type "application/json;charset=UTF-8"
Host "glctracker.golf-loisir-club.com"
Origin "http://localhost:9000"
Pragma "no-cache"
Referer "http://localhost:9000/"
User-Agent "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_0)
AppleWebKit/537.36 (KHTML, like Gecko) Chrome/38.0.2125.122 Safari/537.36"
There is no current session.

Form Variables
Key Type Value
_data_ BLOB 45 bytes

Hope it helps.


--
Robert Ernens
HCTBA Consulting
Look2BookOnline - Web-à-la-Carte
4 Rés. Les Bois du Cerf
91450 Etiolles
Tél.: +33.950.58.95.80
GSM : +33.611.78.44.68





Le 12/11/2014 21:00, « [hidden email] »
<[hidden email]> a écrit :

>CORS issue with angularness and post


_______________________________________________
Active4D-dev mailing list
[hidden email]
http://list.aparajitaworld.com/listinfo/active4d-dev
Archives: http://active4d-nabble.aparajitaworld.com/
Reply | Threaded
Open this post in threaded view
|

CORS issue with angularness and post, cont.

Robert Ernens-3
I worked around the problem by having angularjs changed the Content-type
to "application/x-www-form-urlencoded » and having the json data
serialized using jQuery.parm prior to issuing the angularjs post request.

CONCLUSIONS

The issue though is definitely in the way A4D handles « application/json »
content-type requests.

I must assume that A4D treats it as raw data leaving the parsing of the
payload to me which is fine as long as the query string would be handled
to allow session usage which is not the case for now.

CORS does not seem to work for me.

Maybe will it work better when we move to our production server that runs
A4D 6.1, the test server being still at 6.0.

As a result of the modified content-type, I removed the need to add the
required response headers to handle the Options request in the
postExecutionHook as no OPTIONS request is issued.

I though use « set response header("Access-Control-Allow-Origin"; "*") »
in my executable.

Regards,

---
Robert Ernens
HCTBA Consulting
Look2BookOnline - Web-à-la-Carte
4 Rés. Les Bois du Cerf
91450 Etiolles
Tél.: +33.950.58.95.80
GSM : +33.611.78.44.68


_______________________________________________
Active4D-dev mailing list
[hidden email]
http://list.aparajitaworld.com/listinfo/active4d-dev
Archives: http://active4d-nabble.aparajitaworld.com/
Reply | Threaded
Open this post in threaded view
|

Re: CORS issue with angularness and post, cont.

aparajita
Administrator
> I must assume that A4D treats it as raw data leaving the parsing of the
> payload to me which is fine as long as the query string would be handled
> to allow session usage which is not the case for now.

Correct, the query string should actually be checked for all content types. If the content type is application/json and it's a POST, I should place the parsed JSON into _form.


> CORS does not seem to work for me.

That's because you are trying to do a partial match, and the documentation in Cors.ini was wrong or ambiguous. It's an exact match, unless you use a regex.

Regards,

  Aparajita

_______________________________________________
Active4D-dev mailing list
[hidden email]
http://list.aparajitaworld.com/listinfo/active4d-dev
Archives: http://active4d-nabble.aparajitaworld.com/
Reply | Threaded
Open this post in threaded view
|

Re: CORS issue with angularness and post, cont.

aparajita
Administrator
In reply to this post by Robert Ernens-3
> I must assume that A4D treats it as raw data leaving the parsing of the
> payload to me which is fine as long as the query string would be handled
> to allow session usage which is not the case for now.

This has been fixed in v6.1r11. A session id will always be detected in the query string.

Regards,

 Aparajita

_______________________________________________
Active4D-dev mailing list
[hidden email]
http://list.aparajitaworld.com/listinfo/active4d-dev
Archives: http://active4d-nabble.aparajitaworld.com/