Skip to content
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

Redirect root favicon.ico requests #24821

Closed
solracsf opened this issue Dec 22, 2020 · 9 comments
Closed

Redirect root favicon.ico requests #24821

solracsf opened this issue Dec 22, 2020 · 9 comments
Labels
0. Needs triage Pending check for reproducibility or if it fits our roadmap bug

Comments

@solracsf
Copy link
Member

Browsers are very chatty and tend to always lookup for /favicon.ico.
In the webserver, this logs a 404 for each request.

Solution

Insert a line like

RewriteRule ^favicon\.ico$ /core/img/favicon.ico [L,R=301]

in the .htaccess

@solracsf solracsf added bug 0. Needs triage Pending check for reproducibility or if it fits our roadmap labels Dec 22, 2020
@kesselb
Copy link
Contributor

kesselb commented Dec 22, 2020

Browsers are very chatty and tend to always lookup for /favicon.ico

I disagree. Just tested it with Firefox and Chrome. If <link rel="icon" href="/core/img/favicon.ico"> is present they don't request /favicon.ico.

@solracsf
Copy link
Member Author

Request any file like a CSS or a JS directly:

image

Apache log:

[Sun Dec 20 15:42:36 2020] [core:info] [pid 61562:tid 139881967769344] [client x.x.x.x:50908] AH00128: File does not exist: /usr/www/users/czd/favicon.ico

https://webdesign.tutsplus.com/tutorials/prevent-automatic-favicon-requests--cms-34762
https://www.cisco.com/c/en/us/support/docs/security/web-security-appliance/117995-qna-wsa-00.html
https://bugzilla.mozilla.org/show_bug.cgi?id=260500
https://bugs.chromium.org/p/chromium/issues/detail?id=39402
Etc...

@kesselb
Copy link
Contributor

kesselb commented Dec 22, 2020

Request any file like a CSS or a JS directly:

Because <link rel="icon"> is not set. Usually those files are not requested directly.

@solracsf
Copy link
Member Author

Well, something is, as the Apache logs are full of it without that rule 🤔

@elsiehupp
Copy link
Member

@acsfer I figured it might be easy to add a redirect to the default .htaccess file, so I threw something together. If you want you could checkout the branch and test it, then leave feedback on the pull request.

@solracsf solracsf linked a pull request Jan 25, 2021 that will close this issue
@elsiehupp
Copy link
Member

@kesselb I checked to see if root-directory favicon.ico worked on my Nextcloud installation, and it returns a 404 error for me, too. (I don't know if browsers are are actually calling it, though.)

% curl -I https://cloud.elsiehupp.com/favicon.ico
HTTP/1.1 404 Not Found

The thing is, I'm running nextcloud-snap, so almost all of the server configuration is fully encapsulated. That is, the default Apache configuration for nextcloud-snap is part of the snap package, so even if it's not in scope here, it's in-scope there.

@acsfer if, per chance, you're running nextcloud-snap, could you consider opening a new issue over there and referencing this issue? Thanks!

@solracsf
Copy link
Member Author

Not running snap.

@elsiehupp
Copy link
Member

Hrm! Well, I did run into something interesting in the nextcloud-snap issues: apparently .htaccess issues are kind of, like, a thing there, due to the fact that .htaccess is strictly read-only (and I think just vanilla, from Apache).

nextcloud-snap/nextcloud-snap#52
nextcloud-snap/nextcloud-snap#86
nextcloud-snap/nextcloud-snap#412

.htaccess is imported by httpd.conf here:

https://github.com/nextcloud/nextcloud-snap/blob/6e501950328184d1b7f6297f540f0cf3c6774956/src/apache/conf/httpd.conf#L118

Perhaps plausibly additional directives could be added to httpd.conf itself, but I'm not 100% sure. I don't have a lot of experience with Apache. One thing that seems to be the case is that nextcloud-snap doesn't like sharing a server with other websites, as in Apache Virtual Hosts, which I think traces back to .htaccess being vanilla and read-only.

@szaimen
Copy link
Contributor

szaimen commented Jun 22, 2021

As I cannot reproduce the original issue anymore, I will close this ticket. If this is still happening please make sure to upgrade to the latest version. After that, feel free to reopen. The latest version can be seen by checking https://nextcloud.com/install/#install-clients and https://nextcloud.com/install/#instructions-server respectively.

@szaimen szaimen closed this as completed Jun 22, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
0. Needs triage Pending check for reproducibility or if it fits our roadmap bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants