-
Describe the bugA clear and concise description of what the bug is. To ReproduceSteps to reproduce the behavior:
Expected behaviorAfter a successfull connection setup the sync should also work ScreenshotsDesktop(please complete the following information)
Server(please complete the following information)
Note: Please write down the actual version numbers instead of writing 'latest'. Debug log2021-08-26T06:40:01.836Z Starting sync process for account ****** Additional contextThe sync is not working from my company laptop+network which requires a proxy with authentication for web access. It works though form my private laptop/network where I don't need a proxy. So I guess it has something to do with proxy settings. Firefox itself does work with the proxy. I have the same problem with Chrome - doesn't work from company laptop/network. |
Beta Was this translation helpful? Give feedback.
Replies: 35 comments 23 replies
-
I have the same problem, but I don't believe that this can be fixed by Floccus. |
Beta Was this translation helpful? Give feedback.
-
I don't know what the proxy does and if it deletes the header (and also don't know how to debug). But I can login to Nextcloud via the web page with Chrome or Firefox and the nextcloud sync agent does also work. The sign in for account setup in floccus does also work but the actual sync doesn't. |
Beta Was this translation helpful? Give feedback.
-
@trupf can you see what nextcloud logs on the server (eg. |
Beta Was this translation helpful? Give feedback.
-
I can see the nextcloud logs, but nothing is logged there. But I can also see sslh logs from the server and see that a connection attempt was made, Nginx is configured to not log every access attempt so I think it is really the problem as described by MicMun, that the nextcloud auth header is missing due to the proxy, although I don't understand than how it can work with the nextcloud sync client. Is there a way to authenticate a client without that header? |
Beta Was this translation helpful? Give feedback.
-
@trupf I'm not that familiar with the floccus code, but it looks like
Alternatively as a workaround, perhaps you can make exception for your nextcloud instance so it does not go via proxy (see |
Beta Was this translation helpful? Give feedback.
-
|
Beta Was this translation helpful? Give feedback.
-
@trupf OK, I see that is also using If BlueCoat removes the HTTP Basic auth headers as alleged (and your nginx But what is also interesting is that Can you try to (after logging in to your nextcloud instance) open in your normal browser tabs:
(where and see if they show valid JSON, or return 400/401 error messages? Also share what a Also, could you try if (while using that proxy) you can connect to simple site using HTTP basic auth, like this one:
|
Beta Was this translation helpful? Give feedback.
-
I can not see any issues with both statements in the browser, they complete with no error and return valid json data. The basic auth does also work. I have even another instance on my web-server where I'm actually using basic out with nginx and that works too. |
Beta Was this translation helpful? Give feedback.
-
Few observations, this seems to be the difference in headers sent to server when fetching --- head_floccus.txt 2021-09-19 20:53:16.976555816 +0200
+++ head_browser.txt 2021-09-19 20:42:50.594542889 +0200
@@ -6,0 +7 @@
-http header: "Cache-Control: max-stale=0"
+http header: "Cache-Control: max-age=0"
+http header: "Upgrade-Insecure-Requests: 1"
-http header: "Accept: */*"
+http header: "Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9"
-http header: "Sec-Fetch-Mode: cors"
+http header: "Sec-Fetch-Mode: navigate"
-http header: "Sec-Fetch-Dest: empty"
+http header: "Sec-Fetch-Dest: document"
+http header: "Sec-Fetch-User: ?1"
+http header: "Cookie: nc_sameSiteCookielax=true; nc_sameSiteCookiestrict=true; nc_username=trupf; oc_sessionPassphrase=.....; oc85ae6e4789=l79941cr1es8f5v32h7t72u5il; nc_token=hdrk1SPSsXuodE%2BTwziX9C2Ap1CeKcgD; nc_session_id=l79941cr1es8f5v32h7t72u5il" While any difference might cause suspect proxy to react differently, the most glaring difference is that headers sent by Floccus lack any Cookies, which seem to be already be used for authentication at this stage (your nginx debug logs do not mention So I would guess the problem occurs somewhere before Could you try:
That should capture the authentication attempt. |
Beta Was this translation helpful? Give feedback.
-
Above you wrote "after logging in to your nextcloud instance" so it is clear authentication is already done. Anyway as long as I don't explicitly log off or delete cookies I don't need new log in to nextcloud, even if I restarted my computer or started a new browser session. So authentication is probably done with cookies and only if no valid cookie found with a new login. I can follow your procedure above but you will find multiple connections than, as it will take longer an I cannot filter for just floccus. Just to make you aware I don't fill in the password field in floccus. Instead I'm using the button right at the end of the user name field to sign in with the browser (which is working, but the sync afterwards doesn't). This way I would expect floccus to create a cookie for authentication and use it (same way as the nextcloud sync client does). This way floccus does work on my home computer (without company proxy). I also tried to use a separate app password for floccus (as I have 2 factor auth enabled) but this doesn't work either. |
Beta Was this translation helpful? Give feedback.
-
Fyi, using the nextcloud login flow produces an app password which is sent via the Basic Auth header just like a normal password. To test the authentication I recommend using curl as follows: curl -u "username:apppassword" -vvv https://your_nextcloud.example.com/owncloud/index.php/apps/bookmarks/public/rest/v2/folder/-1/hash |
Beta Was this translation helpful? Give feedback.
-
here is the requested debug log. This time i have not deleted previous (as I think unrelated) requests. I can not use curl on my company laptop (and if I would need a way to use the proxy). But with my private and without the proxy the request ist working. |
Beta Was this translation helpful? Give feedback.
-
Yes I did, for the 2 URLs you manually entered in web browser. What I'm trying to find out here is how floccus internal method (which doesn't work for you) differs from the way normal browser tabs works. If they worked in exactly the same way, they would both work (or both fail). The interesting part is that one method (web login in normal browsing tab, which produces cookie) works, while the other (floccus addon auth) fails. Request generated by floccus in my case (with separate app password) looks like:
So in my case Floccus uses HTTP basic auth on each request, instead of "form login submit sets cookie" like web-browser login on nextcloud does. Since you say you were able to login on https://authenticationtest.com/HTTPAuth/ which also use same HTTP basic authentication method, floccus HTTP basic auth should work too. If it doesn't, and BlueCoat strips authentication header before it reaches your nextcloud instance, but does not strip it for https://authenticationtest.com/HTTPAuth/, there must be a reason, and that reason is determined by request that is sent to proxy server. If requests were exactly the same, the result must be exactly the same too. But they never are completely the same, so BlueCoat might strip authentication header (if it really does that) depending on whether:
Or in all cases, you can try contacting your proxy administrator, and see if the restrictions can be changed/lifted, of course.
Ah, I'm not sure how that way works; but is possibly harder to debug if it works differently. Could you try removing that floccus account on your company laptop, and setup a new account with separate app password for floccus, and send me that 6-step logs for that? Mixed requests should not be a huge problem, as all that pass through your company proxy seem to have Also, when you say you can't use |
Beta Was this translation helpful? Give feedback.
-
@trupf if you can install
It would hopefully show if any of the extra headers have effect on proxy, and are there certificate differences that might be problematic. Depending on the results, I can setup (if needed) few URLs that would test if it is path values that are problematic instead. |
Beta Was this translation helpful? Give feedback.
-
https://authenticationtest.com/HTTPAuth/ is blocked at my company, but it is interesting that folder and bookmark is acting different.
The request is identical: Authorization, User-Agent and "Accept: */*" is send to nextcloud. The DNT header makes no difference in output (I tried with and without DNT). The main differences in the response I can see: The whole output has too much critical infos, so I cannot provide this to you. But perhaps the diff helps. I'm really surprised, that the requests differs in the result. I thought, the proxy does always the same thing and the problem must also be always the same. |
Beta Was this translation helpful? Give feedback.
-
@trupf thanks! It indeed confirms that BlueCoat is eating authentication header sometimes, and that --- curlreq2_sent.txt 2021-09-22 02:33:07.471457994 +0200
+++ nginx_rcvd.txt 2021-09-22 02:33:07.859460481 +0200
@@ -3,2 +3,3 @@
-Authorization: Basic BBBBB
+Cache-Control: max-stale=0
-Cache-Control: no-cache
+X-BlueCoat-Via: 268346fa85a569a0 However the third curl call was missing trailing slash (
I'm quite interested how it will handle that one in which HTTP basic auth is supposed to be working. Also, this one, to see how other part of nextcloud (which behaves differently) handles basic auth:
|
Beta Was this translation helpful? Give feedback.
-
If it helps, I have a curl execution with success: The output: The first request is without basic authentication, the second request (curl does this automatic) is with cookies and basic authentication. The request get the right result. |
Beta Was this translation helpful? Give feedback.
-
I think second request went through as first one was answered with an error 401, so BlueCoat let the Authentication: Basic header through for second request, same result as my log files show, so probably not due to the coockies. |
Beta Was this translation helpful? Give feedback.
-
Yeah, I think @trupf is correct here, and nextcloud cookies are unrelated in @MicMun working connection - what is important is that the client first tries with no auth, and only when it gets To confirm that, would you both @trupf and @MicMun please try this two commands (add your
If the assumption is correct, the first command will succeed for first command (in automatic 2nd try), but will still fail with second command. When I see that two |
Beta Was this translation helpful? Give feedback.
-
@mnalis The second request is 400 Bad request, this was suspected. See also https://knowledge.broadcom.com/external/article/200712/what-is-the-http-header-bcsics-cookie-se.html |
Beta Was this translation helpful? Give feedback.
-
@Mnails: |
Beta Was this translation helpful? Give feedback.
-
@mnalis I can not test until tomorrow, because I'm already at home. But I don't believe that an other number than from proxy will work. |
Beta Was this translation helpful? Give feedback.
-
The missing "p" at index.php might have been the problem. So here are the logs curl_http_11.txt |
Beta Was this translation helpful? Give feedback.
-
I would fix this with saving the cookie name after the first failing request (cookie is in the response) and after that, the cookie can be send with each request. If the name changed after some time, you can update the name after the response of a failing request. |
Beta Was this translation helpful? Give feedback.
-
Yes, thank you @MicMun and @trupf, I think we've got to the bottom of this - as they say, finding a problem is half work done!
|
Beta Was this translation helpful? Give feedback.
-
Floccus should IMHO be modified to support proxies which drop unsolicited This is what I would suggest to be done in
As this is now an actionable item, if @marcelklehr agree I would make a new issue (out of just this comment)? If I were forced to, I'd probably be able to scrounge something that works (with massive help from testers), but as I neither really speak typescript, and especially all that object-oriented, try/catch and async/Promise model is alien to me, it would probably look quite horrible (like an |
Beta Was this translation helpful? Give feedback.
-
If you just store the BSCI-CS... this shouldn't be a problem the cookie is just for the proxy and does not even reach nextcloud. On the other hand all web sites go through the proxy, so the cookie will be set for every one anyway. You don't even need to explicitly store a cookie file, you could just store a text string and add it as header. And you are right, floccus is not the last app that has problems with this behavior. |
Beta Was this translation helpful? Give feedback.
-
Yes I can confirm, checking the "Send client certificates" checkbox makes floccus work for me. |
Beta Was this translation helpful? Give feedback.
-
First sync never completed. I had to stop and restart it, than it worked. At browser restarts the first sync is immediately successful as long as the cookies are kept (I usually delete all when I close the browser, but now I've added an execption for nextcloud) |
Beta Was this translation helpful? Give feedback.
-
@mnalis I can confirm, @trupf I think, floccus needs the cookies to succeed and thats the reason for the need of restart. |
Beta Was this translation helpful? Give feedback.
Floccus should IMHO be modified to support proxies which drop unsolicited
Authorization
headers (ie. when authorization is sent immediately, and not after401
), by retrying same request with new cookies received. RFC 7235 (which is by now over 7 years old), does seem to allow for proxies to dropAuthorization
headers (it was previously required that proxiesmust forward the WWW-Authenticate and Authorization headers untouched
, but that restriction seems to be relaxed now to just forbid modifying them)This is what I would suggest to be done in
sendRequestNative()
(or is itsendRequestWeb()
?) inNextcloudBookmarks.ts
:fetch()
withAuthorization:
header fails withres.status === 401
,…