When using facebook connect, if I visit the website without the "www" in the URL, the connect button doesnt function properly. My website will load in the pop-up window after you sign into facebook, instead of closing and reloading the main page logged in. This error also appears while logged in as admin:

""The Facebook Application labeled SewFresh has a suspicious connect_url. The value is http://www.sewfresh.com/, while something starting with http://sewfresh.com was expected. Consider editing SewFresh.""

Is there a way to fix this so it can work both with and without the www?

Comments

SewFresh’s picture

Component: Code » Facebook Connect
Dave Cohen’s picture

Status: Active » Closed (won't fix)

This message comes from fb_devel.module. It's a warning visible to administrators and maybe written to the log. The idea behind the message is to catch problems where data is copied from say devel.example.com to www.example.com. In a case like that, its important to update the application, while in your case where the two domains are the same server it doesn't really matter.

Supporting two domains, like www.sewfresh.com and sewfresh.com is a bad idea. Pick one an use only that url. You'll notice for example if you go to any url at www.drupal.org, you'll be forwarded automatically to drupal.org.

haopei’s picture

I am getting this problem as well.

How do I configure a drupal website to use one url only?

justindodge’s picture

Version: 6.x-2.0-rc1 » 7.x-3.x-dev
Category: bug » feature
Status: Closed (won't fix) » Active

Sorry to reopen this issue, but I was having a similar issue where facebook just says "an error occurred" if I use the www.domain as opposed to the non-www version.

I came across this issue and your statement about supporting two domains, and I thought it might be worth revisiting, because it doesn't seem like there is anything inherently problematic with it.

I'm obviously not as informed about the functionality on the back end, but I do know two things:
1. If you edit your app settings on developers.facebook.com, there is a field for app domain that not only says "example.com will enable *.example.com", but it also allows you to use completely separate domains as well.

2. Over in twitter land, using oauth, we just submitted a patch that dynamically generates an absolute URL that contains the callback url after authentication, effectively allowing you to use the same app from whatever domain you want. For reference, the issue is here: #940060: Use oauth_callback to pass current domain when authenticating

Thoughts? I'd be open to working on a patch if it seems doable.

Dave Cohen’s picture

re #1: You can manually type your domain into that field on the facebook settings, then your app should work OK on example.com and also www.example.com. That property can be set manually, but not automatically by the module.

You'll still see the warning, if you are an administrator visiting your site and fb_devel.module is enabled. To not see the warning, the easiest workaround is just to administer always with the www (or always without).

re #2: I don't understand exactly, but if you can accomplish that with a facebook connect button I'd love to see the patch.

Personally I recommend using .htaccess to always bounce a visitor to the domain that starts with www.

justindodge’s picture

@Dave
re re #1: As I understand the directions on facebook, it's not necessary to add the www.example.com, since the base domain automatically allows *.example.com. Do you think that's incorrect? To be clear, my personal issue is not with the fb_devel warning, I was getting "an error occurred" in the facebook window when using www.example.com

re re #2: Primary reason as stated in the issue I linked to is to handle connect across domains for a multi-site installation, but this also seems to fit the www vs non www use case.

Although I can certainly understand the reason for preferring the .htaccess method for redirecting www, to me it just sort of seems like www/non-www "should" work out of the box. I don't really have a strong argument to back that up, except that it's not that uncommon to access a site both ways without a redirect.

Being able to use a single fb app for a multi-site does sound cool though. Understandably it may not be the highest priority on your list, but if its possible to provide callback and redirect URLs within connect requests, wouldn't that eliminate the need for the 'sync props' and other manual entry of the urls? Besides eliminating extra configuration, it would make the local URLs easy to change in the future. I defer to you on this idea though, just brainstorming.

Dave Cohen’s picture

An app on facebook has a bunch of properties, and several of them are URLs back to your server. So Facebook will know your server as either www.example.com or example.com, but not both.

If and only if you manually type "example.com" into that special field on the settings form then both URLs will work OK with facebook connect.

You're in the world of facebook apps now. Many things you expect to work, will not. Try to get used to it. :)

13rac1’s picture

Status: Active » Closed (won't fix)

Setting back to previous status since it still applies.