I installed Drupal on AWS ec2 server (using httpd)
I can't seem to login when using chrome, but when using firefox the site works normally
Steps to reproduce:
Did a fresh install of Drupal 7.54 on my AWS ec2 server (using httpd)
Enter admin's username / password in the field
Behavior:
In chrome, when I enter admin's username / password and submit, the page "accept" the input, changes url accordingly, but never actually logs in.
I see no admin bar, no welcome message, and an access denied message if it navigates to the user page.
What I tried:
Clearing the cache, cookies, starting in an incognito session, using a ssl self signed certificate, reinstalling drupal, changing php version, changing username / pass, deactivating every plugin
Site url:
http://ec2-52-90-159-201.compute-1.amazonaws.com/test/
Site admin:
username admin
userpass test
Comments
Comment #2
Marc-Antoine CreditAttribution: Marc-Antoine commentedComment #3
djalxs CreditAttribution: djalxs as a volunteer and commentedWould you be able to post access & error logs for this, as I believe this to be a server issue as opposed to a Drupal issue.
Comment #4
rhuffstedtler CreditAttribution: rhuffstedtler as a volunteer and at ICF commentedI just reproduced this same behavior when we stood up a new instance of a project on AWS. Haven't had enough time to figure out what's causing it yet. I do suspect it to be some kind of config issue, though.
Comment #5
djalxs CreditAttribution: djalxs as a volunteer and commented#rhuffstedtler, can you post logs?
Comment #6
David_Rothstein CreditAttribution: David_Rothstein as a volunteer commentedOften this happens due to a mismatched $base_url in settings.php. Check your settings.php file and see if a hardcoded $base_url is being used there, and if so, whether it actually matches the URLs people are visiting the site at when they experience the problem.
If there's a mismatch, either fix the $base_url to match, or consider whether you actually even need a hardcoded $base_url in the first place.
Comment #7
David_Rothstein CreditAttribution: David_Rothstein as a volunteer commentedComment #8
cv_jetware CreditAttribution: cv_jetware commentedI confirm the same problem with fresh Drupal 7.54 install on AWS ec2 (using nginx without apache httpd). The settings.php is left intact, without hardcoded $base_url.
If you can give advise where we could look further, I'd update this bugreport with more details
Comment #9
David_Rothstein CreditAttribution: David_Rothstein as a volunteer commentedMaybe use a web debugging tool to check what cookies are set for the site's domain (and any other domains closely related to it)? You'd be looking for a session cookie with a name that starts with "SESS..." since that's what Drupal uses for login. (Based on the symptoms, I would still think the most likely cause here is that Drupal believes it set the cookie but somehow didn't set it for the correct domain.)
You could also look in the Drupal and server logs for any error messages as @djalxs suggested above.
#2379019: Connection fail with PHP 5.6.1 suggests maybe this can occur if the site is running particular buggy versions of PHP, although in that case I wouldn't expect it to be Chrome-specific.
Comment #10
levmyshkinI fixed it. I had to run the following command:
sudo a2enmod rewrite
Comment #11
zckpp CreditAttribution: zckpp as a volunteer commentedI am having the same issue.
No luck with $base_url.
Comment #12
zckpp CreditAttribution: zckpp as a volunteer commentedConfirm with the same issue on Drupal version: 7.56, PHP 5.6.31
Comment #13
deepikakaran CreditAttribution: deepikakaran commentedSetting up $cookie_domain in settings.php worked for me. Initially, I was not clear how to set cookie_domain variable for ec2 instance and finally fixed it by providing value like the below format.
$cookie_domain = 'ec2-xx-xxx-xx-xxx.compute-1.amazonaws.com';
Comment #14
preethivv CreditAttribution: preethivv commentedAbove solution not working for me. Any other solutions?
Comment #15
wadley0 CreditAttribution: wadley0 commentedFor me the issue was that I had an existing cookie already stored in chrome for the same domain (existing site I'm moving). Once I deleted that cookie, it worked.
Comment #16
rjacobs CreditAttribution: rjacobs at Center for Research Libraries commentedAs most of these posts are specific to dev domains hosted at a
compute-1.amazonaws.com
subdomain I'm assuming this is related to the way Chrome interprets the Public Suffix List. It seems that*.compute-1.amazonaws.com
(note the wildcard) is treated as a controlled TLD for which cookies should not be accepted.More info is outlined here.
I'm not sure why setting
$cookie_domain
would get around this, but another workaround for dev setups using AWS hosts may be to simply use the IP address as the host, as all browsers should accept cookies under an AWS IP.Comment #18
apadernoComment #19
longwaveAs #16 alludes to, this is by design. This is for security; if you end up setting a cookie for the domain .compute-1.amazonaws.com then you might accidentally send your cookies to another unrelated site that is also hosted on AWS. If you use a domain that you are in control of, there is no chance of this happening.
See also https://stackoverflow.com/questions/43520667/cookies-are-not-being-set-f...