-
Notifications
You must be signed in to change notification settings - Fork 2.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Workaround to check htaccess in case of redirects #25331
Conversation
In some setups, the web server will redirect any call to "data/" to the main page. This causes the XHR to return the 200 HTTP status code and the body contains the HTML page of the main page / files app. This fix improves the htaccess failure detection by adding a known string inside the test file "htaccesstest.txt". If we are able to find this string, it means that the web server didn't block access to that file.
Mhhh, why adding the |
@RealRancor because the JS side needs to check whether the 200 response contains that string. This happens in greysun's environment. We can't detect 302 redirects with XHR/ajax as the browser will automatically follow redirects. |
@RealRancor also I didn't want to copy the whole exact |
Nextcloud already has a patch for this in all releases. Didn't test the ownCloud patch but it looks pretty similar and should do it's work. 👍 for the approach itself. |
@LukasReschke I think there's a slight risk if one day someone changes the message in one place but not in the other. In this case people might get false positives that their server is safe when it's not. That why I opted for adding "HTACCESSTEST" instead with a comment. Also this has the advantage that the message is only in one place. |
also: slight risk in case of newlines, if fwrite would add one, not sure if it does... |
|
Ahhh, i didn't know that. My question above was based on the assumption that you could only match partially for e.g. When thinking about it the HTACCESSFAIL is also a better approach as the changes that this text got changed is less likely. |
Fixes #25416 |
This was tested by greysun on IRC, counting as 👍 |
Also confirmed to work here: https://forum.owncloud.org/viewtopic.php?f=38&t=37580#p119487 |
Damn, I didn't see that JS tests were failing. Will send a follow up PR |
Here we go #25439 |
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
In some setups, the web server will redirect any call to "data/" to the
main page. This causes the XHR to return the 200 HTTP status code and
the body contains the HTML page of the main page / files app.
This fix improves the htaccess failure detection by adding a known
string inside the test file "htaccesstest.txt". If we are able to find
this string, it means that the web server didn't block access to that
file.
Reported by greysun on IRC.
Please review @RealRancor @LukasReschke @danimo @DeepDiver1975 @guruz @georgehrke
Would be good to backport this to 9.1 and 9.0 to avoid annoying false positives.