Hello,
I am submitting the question only to check if I don't have any trouble with my server / scripts. What I have seen is that I don't receive a response after a HttpClient or SimpleGet requests. I receive it after a POST but not a GET.
I have created a sample project located at https://s1.applicateur.fr/appb/test/MyApp.zip
My script by itself is written in LiveCode language and does only this :
put the long date
It can be tested using a browser and if I well remember we already made some tests on this previously.
On the server, the CORS are enabled. Perhaps the problem is on my own machine ?
Any idea will be welcomed as usual :)
Many thanks
Hello Samuel,
The problem is related with CORS and, yes, probably the same request in previous App Builder releases works fine: in fact a couple of releases ago I introduce a "prevent cache" enhancement that works, but requires some CORS related attention which previously do not matter.
Try to run the debugger and then use the debugger toolbar to open the app using Firefox, then press F12 in Firefox to open the developer console and you can see the problem: we need to set the "'Access-Control-Allow-Headers" in the server response to properly enable CORS.
As you can see in the current included app samples in PHP we can do something like this to enable CORS for the latest App Builder releases:
Really I don't know how to do it in "LiveCode", but, probably you can found more information about how to properly set the "Access-Control-Allow-Headers" response header. Certainly this change in App Builder can cause this problem, however, we need to introduce an internal "non cache" enhancement, since the cache can cause other problems maybe too much complicated.
Please Samuel, post here your doubts or your "LiveCode" solution: maybe other people can also get benefict of that.
Many thanks David for your quick and detailed reply. I will have to find the proper way to implement that :)
A++ grade service ;-)
Hello,
Always thanks you Samuel! What we need is to "clone" the above PHP code in LiveCode. Before the "cache" changes, the "Access-Control-Allow-Origin" header are sufficient, however, the "cache" changes requires to fill the "Access-Control-Allow-Methods" and "Access-Control-Allow-Headers" header in the server response.
Hello David,
I have tried to translate the PHP code to the LiveCode one but it still doesn't produce any data after a GET request.
So, I have used Firefox and the Live headers extension to check the headers.
Please, may I ask you if you could see anything different or missing compared to your own headers ?
https://s1.applicateur.fr/appb/test/index.lc
OPTIONS /appb/test/index.lc HTTP/1.1
Host: s1.applicateur.fr
User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:43.0) Gecko/20100101 Firefox/43.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: fr,fr-FR;q=0.8,en-US;q=0.5,en;q=0.3
Accept-Encoding: gzip, deflate
Origin: http://127.0.0.1:9990
Access-Control-Request-Method: GET
Access-Control-Request-Headers: cache-control,if-modified-since,pragma
Connection: keep-alive
HTTP/1.1 200 OK
Date: Thu, 22 Oct 2015 17:04:51 GMT
Server: Apache
access-control-allow-methods: GET, POST, OPTIONS
access-control-allow-origin: *
Vary: Accept-Encoding
Content-Encoding: gzip
Content-Length: 46
Keep-Alive: timeout=5, max=99
Connection: Keep-Alive
Content-Type: text/html; charset=iso-8859-1
Many thanks :)
Edit: just saw and understood that the third test was not returning the header. I will have to work on that point too
Edit: when not using a test and forcing the requested headers to their default values, it works. I will have to search if those headers are available in LiveCode server too.
Hello Samuel,
Please, sorry for the delay: I expend the day at the hospital with my mom. About our issue, I think your headers are correct. May we can missing some header in "Access-Control-Request-Headers"? But Firefox and their developer console probably tell us what can be happend or the missing header. Maybe the "Origin" must be something different to http://127.0.0.1:9990"? You can try (at this time) with an "*" (asterisk), which apparently works fine in PHP. But I can't view anything wrong in the above code.
If you need that I try the script or something like that just tell me.
Hello,
Here is my feedback after some hours and several trials.
With LC server the headers used in the PHP script seem not to be exposed in $_SERVER[] (for livecoders, the libURLLastHTTPHeaders() function had no use for me too). So there is a need of sending them on a fixed basis and we can't rely on the tests.
If you use sessions, they must be started before sending the headers. The headers must be sent before any other message.
A remark about the first instruction : I have several VPS running LC server. I have noticed that on some I had to comment the first line (the one about the Origin) because some of my Apache versions did already send the information about the origin and, studying the headers returned, I had the star twice.
The last question is this one for our host, David : is it normal that the debugger won't receive any result of a GET request while a browser launched in debug mode will ?
Many thanks :)
Hello,
Thanks for the feedback Samuel.
The last question is this one for our host, David : is it normal that the debugger won't receive any result of a GET request while a browser launched in debug mode will ?
I am not sure if understand well your question. If the problem is why the debugger can't tell us the HTTP call fail due to "CORS" problem, for example (and just like the Firefox debugger can doing), I only can say that I need to investigate it in order to found a possible way to do it. Currently script errors are reported by the debugger, however, apparently, not this kind of errors: I don't know if the used Browser control do not provide such information or what. But I will investigate this Samuel.
If I am not understand your question, please, explain a little bit and I try to help you Samuel.
Hello David,
What I mean is :
- after having added the necessary headers, in debug mode, App Builder seems not to get the reply from the server
- if I execute the same code from the debugger but in a browser, this one receives the response from the server
I have made a ScreenGif about
[img=ScreenGif]https://s1.applicateur.fr/appb/test/GETrequest.gif[/img]
On the left App Builder's in debug mode and on the right Firefox developer edition.
On the left, we don't receive the time and the HttpStatus gets -1
On the right, we receive the time and the HttpStatus gets 200
I hope to have been clearer about and do apologize for the previous question :)
Hello,
Don't worry: what I understand from your question is still valid and I need to investigate that. But now the point is very clear.
Do you use the same sample app that attach in your first post? Because I just download it again and, apparently, I receive the correct response from the server:
Anyway, try to remove manually the "_Compiled" directory of the app and then compile it again and try it.
If you use other end point (URL) for the request, please, give me the URL in order to try it here by myself.
Todo el mundo puede leer el foro de soporte de DecSoft para aprender del mismo, sin embargo, sólo los clientes de DecSoft pueden abrir nuevos hilos. Compre una o más licencias de productos de DecSoft y obtendrá este y otros beneficios.