WorkHabit Blogs

WORKHABIT LABS

Session Issues with Drupal on Safari

by Nick Russell Published: December 2nd, 2008
Tagged: browsers, drupal, drupal planet, sessions

It has been talked a lot that people are experiencing issues with their user's sessions on their drupal sites in Safari. Most experience the same issue:

  • A user logs in, tries to create content and are kicked / logged out and taken to the homepage

It appears the bug has something to do with the way Safari handles URLs (Domain Names). For most localhost environment set ups, its easy to put whatever we would like as our site domain. But there is a problem when it comes to adding (_) verse (-) in those names.

For Example:

  • localhost/mywork_sitename: This would cause a problem in Safari because an underscore is not considered a valid character.
  • localhost/mywork-sitename: This would correct the sessions issue. Safari interprets this as valid and this fixes the session issue experienced.

So, if you are experiencing issues with your sessions being terminated for an account in your development environments for specific browsers, insure that your URLs (Domain Names) are valid. It fixed most issues in Safari for users experiencing the same bug.

Solution originally discovered by Nestor Mata.

Here is the only issue I

Here is the only issue I could find on drupal.org:

http://drupal.org/node/158120#comment-970650

Who wrote this originally?

Who wrote this originally?

I believe it was originally

I believe it was originally written by Nestor Mata who works for Achieve Internet in San Diego. Credit where credit is due. English is his second language, you can tell by the writing style.

Hi **** I dont think Nick

Hi ****,

I dont think Nick was trying to ‘steal’ credit, he was merely posting information to help people out.

"Anonymous"

This documentation was written by myself. Original discovery of this bug was credited to Nestor Mata, who shared this information with me months back. If more detailed documentation has been written by Nestor, please provide a link to everyone for better reference.

Additionally, posting a question that you yourself answered as well seems a bit odd. If you have a link to any original documentation, please provide that as reference.

Thank You

_ is a valid character

I was just reading up on the URI RFC. It seems that _ is a valid url character. See http://www.ietf.org/rfc/rfc2396.txt and http://www.w3.org/Addressing/URL/url-spec.txt.

This looks to be a safari bug if it doesn’t like it.

Domain names

An underscore is valid in a URI, but not in a domain name. Perhaps that’s the issue here?

It's the underscore

Although the underscore is indeed a valid character, it’s what’s causing your issue. We’ve experience this before when setting up servers with _dev and _stag suffixes. Replacing the underscore with a dash will solve your issue.

Correction to Underscore in "URL"

Correction, what I was referring to was the “Domain Name”, thank you Adam. Thus my example explaining the difference between (_) and (-) inside the domain name on local environments. “URL” was the incorrect term to use as adding underscores in your URL IS valid.

Additionally, according to “Matt Farina”, yes this does appear to be a safari bug. I have not personally experienced this problem in any other browser myself. Should one experience this in another browser, please do share your experience as well.

It also applies for IE some random versions

This issue is not only referenced to happen on safari, but also on some random versions of IE. The issue we had was with some users not loging in and after looking into several forums I found out that people was able to identify that is related with the _ on the domain name (not the URL). So, solution is to never use _ on the domain name on live sites nor local enviroments, this could save you from some pain from random issues.

Nice reading you again guys :)

Nestor

Underscore is not valid in hostnames (and hence most DNs)

I think this would explain it - http://tools.ietf.org/html/rfc3696#section-2

Post new comment

The content of this field is kept private and will not be shown publicly.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd> <blockquote> <h3>
  • You can use Markdown syntax to format and style the text.

More information about formatting options

Papernote
Papernote

Upcoming Events

WorkHabit Labs Archives