Vary favicon by domain
danielflippance opened this issue · comments
I serve multiple domains from a single Express app and would like to be able to change the favicon for each domain. ie: I want to vary the image file I choose to pass to favicon() based on req.hostname. The hostnames are chosen by the users and are sometimes only different by the sub-domain.
I can't see a way to vary the favicon chosen based on req.hostname and reading this issue it seems there may not be a way to do so.
I'm not 100% sure I understand what you're trying to do? Do you think whipping up a proposal PR would help?
Good plan. I've added PR #32 as a potential implementation
Could you do this? Just a thought based on the current usage pattern in the README.
var exampleIcon = favicon(...);
var defaultIcon = favicon(...);
app.use(function (req, res, next) {
if (req.hostname === 'example.com') {
return exampleIcon(req, res, next);
}
return defaultIcon(req, res, next);
});
Conversation conclusion in the PR: #32 (comment)