After some more research, I think the problem is server related.

According to this article 
: 
http://stackoverflow.com/questions/37298843/angular-2-response-for-preflight-has-invalid-http-status-code-401-error
the server shouldnt ask ro credentials for OPTIONS requests.

So I think this is a "bug" in sabredav 3.2

Don't you think ?


Le mardi 10 janvier 2017 18:22:46 UTC+1, Lionel VEST a écrit :
>
> I can make the client.js work if I install iton the same server as 
> SABREDAV server
>
> I redirect all the traffic to my server.php file, except one subfolder 
> named "client", using this APACHE rules :
>
> RewriteEngine On
> RewriteCond %{REQUEST_URI} !^/client.*
> RewriteRule ^/(.*)$ /server.php [L]
>
> In that 'client' folder, i place my index.html and my client.js file.
>
> If I give a Username and Password when creating the dav.client object, it 
> doesn't work. It keeps asking me for the login / password in an infinite 
> loop
> But if I connect without specifying login and password, it works
>
> So I managed to make it work, but only when the client runs on the same IP 
> as the server.
> cross server communication doesn't work. I always get ERROR 401
>
>
> Le mardi 10 janvier 2017 15:35:02 UTC+1, Lionel VEST a écrit :
>>
>> After some investigation, i think this is related to the Rewrite Rule in 
>> the vhost conf
>>
>> RewriteEngine On
>> RewriteRule ^/(.*)$ /server.php [L]
>>
>> But how am i supposed to run the server without this rule ?
>>
>> Le mardi 10 janvier 2017 14:53:00 UTC+1, Lionel VEST a écrit :
>>>
>>> Hi Evert,
>>>
>>> I was looking for a JAVASCRIPT Webdav Client that can communicate with 
>>> my SABREDAV server.
>>> I just discovered your GITHUB project : 
>>> https://github.com/evert/davclient.js
>>>
>>> I made some tests but the server I try to connect is not on the same 
>>> domain.
>>> The problem is that GOOGLE CHROME doesn't allow cross domain requests 
>>> (CORS).
>>> I got this error : *"Response to preflight request doesn't pass access 
>>> control check: No 'Access-Control-Allow-Origin' header is present on the 
>>> requested resource."*
>>>
>>> I found that adding this line to my server.php can partially solve the 
>>> problem :
>>>
>>>  header("Access-Control-Allow-Origin: *");
>>>
>>>
>>> But now the error is different : *"Response for preflight has invalid 
>>> HTTP status code 401"*
>>> What does it mean ?
>>> How can I fix this ?
>>>
>>>
>>> Second question : in order to use davclient.js, I have to write the 
>>> login / password in the javascript source code.
>>> This isn't very secure because the user can read the code.
>>> Is there a solution to avoid this ?
>>>
>>>
>>> Best regards
>>>
>>

-- 
You received this message because you are subscribed to the Google Groups 
"SabreDAV Discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sabredav-discuss+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sabredav-discuss/b9905d24-1e49-4cf6-bed6-50b9a863d930%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to