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

Marc-Antoine created an issue. See original summary.

Marc-Antoine’s picture

Issue summary: View changes
djalxs’s picture

Would 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.

rhuffstedtler’s picture

I 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.

djalxs’s picture

#rhuffstedtler, can you post logs?

David_Rothstein’s picture

Often 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.

David_Rothstein’s picture

Status: Active » Postponed (maintainer needs more info)
cv_jetware’s picture

I 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

David_Rothstein’s picture

Maybe 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.

levmyshkin’s picture

I fixed it. I had to run the following command:
sudo a2enmod rewrite

zckpp’s picture

I am having the same issue.
No luck with $base_url.

zckpp’s picture

Confirm with the same issue on Drupal version: 7.56, PHP 5.6.31

deepikakaran’s picture

Setting 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';

preethivv’s picture

Above solution not working for me. Any other solutions?

wadley0’s picture

For 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.

rjacobs’s picture

Title: Can't login in chrome » Can't login in chrome with site hosted on compute-1.amazonaws.com subdomain

As 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.

Version: 7.54 » 7.x-dev

Core issues are now filed against the dev versions where changes will be made. Document the specific release you are using in your issue comment. More information about choosing a version.

apaderno’s picture

Status: Postponed (maintainer needs more info) » Active
Issue tags: -admin login problem, -user login, -login
longwave’s picture

Status: Active » Closed (works as designed)

As #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...