I'm having an issue using Fontdeck on a domain with a www prefix. I have added both www and non-www version to my Fontdeck configuration. For one reason or another, beyond my control, the Drupal site is only available on the www domain. What I'm wondering is why on earth fontdeck_get_domain() makes an assumption that it's ok to strip www? I have found that changing that single line of code fixes my problem, but submitting this as a support request because I'm not sure if there is a good reason for it.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

sreynen’s picture

Title: Why does fontdeck_get_domain() strip www? » fontdeck_get_domain() stripping www causes domain match failure
Category: support » bug

Good question. I can't find any documentation on this, but I think maybe when we were initially testing the API, it would only match on non-www domains. If that's not the case now, we should change the code.

mstrelan’s picture

Status: Active » Needs review
FileSize
829 bytes

Patch

Drave Robber’s picture

According to http://fontdeck.com/support/troubleshooting,

If it can be accessed with and without the www, then you need to add both domains (example.com and www.example.com).

So it definitely "thinks" www and non-www are different. Obviously, it also checks the referrer and is quite strict about it.

The patch looks good (hey, it also fixes that silly typo in the comment above :); unfortunately, I have no capability to test it properly at the moment.

Drave Robber’s picture

I set up www.fyf.local in addition to fyf.local, added both as domains to my Fontdeck project, enabled one font, and hey - it works on www.fyf.local even though requested via http://f.fontdeck.com/s/css/hiLWjqcm3fXPpBf3PaBeLgn8Dis/fyf.local/29429.css. So the important part is adding www. domain to the Fontdeck project, but the domain in request URL isn't really important.

Not all fonts work, though - some (not to say half of them) refuse to work altogether. I reckon some API information might be outdated. At the moment, I'm not sure what to do about this. Not "outdated", but "not updated instantly", and it seems to take wildly different time to update (from 10 sec to 5 min) - got me confused.

Still not sure what to do next and whether there is anything in need of a fix. More testing, esp. on real domains, welcome.

Drave Robber’s picture

Title: fontdeck_get_domain() stripping www causes domain match failure » fontdeck_get_domain() - stripping www is not necessary
Category: bug » task
Priority: Normal » Minor

On the other hand, this patch might be justified simply on "don't do redundant stuff" grounds. I'm inclined to leave this hanging while other Fontdeck issues are solved (see below).

The real reason why Fontdeck acts up with multiple domains seems to be altogether different. fontdeck_fontyourface_import() adds CSS only for the domain you're currently on, which is not always appropriate. Until we've figured out what to do about this, you're left with somewhat silly option of repeating 'Import Fontdeck fonts' on every domain.

Neslee Canil Pinto’s picture

Issue summary: View changes
Status: Needs review » Closed (outdated)