question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Aliases in /etc/hosts for 127.0.0.1 causes a "Bad request" error

See original GitHub issue

Meta -

OS: Debian 7.10

Selenium Version: 2.53.0

Browser: Firefox

Browser Version: 45 (package is 45.1.0esr-1~bpo70+1)

I’ve created a daemon which, when run, starts up Xvfb and Selenium 2.53.0 in the background. When I run my test, I get the following error:

When I visit "user"                                                                                                                    # Drupal\DrupalExtension\Context\MinkContext::assertAtPath()
      Could not open connection: Bad request
      Command duration or timeout: 11 milliseconds
      Build info: version: '2.53.0', revision: '35ae25b', time: '2016-03-15 17:00:58'
      System info: host: 'server.example.net', ip: ‘172.xx.xx.xx', os.name: 'Linux', os.arch: 'amd64', os.version: '3.2.0-4-amd64', java.version: '1.7.0_101'
      Driver info: org.openqa.selenium.firefox.FirefoxDriver (Behat\Mink\Exception\DriverException)

After discussing with a colleague, it was determined the error was occurring due to the order of the 127.0.0.1 entry in /etc/hosts, which directly relates to https://github.com/seleniumhq/selenium-google-code-issue-archive/issues/3280. I have this in /etc/hosts:

127.0.0.1       localhost.localdomain   localhost

When I reverse that to be:

127.0.0.1       localhost   localhost.localdomain

the test runs fine.

The /etc/hosts file is Puppet managed across our infrastructure, but more importantly, it was correct in the first place: an FQDN should come first followed by the short name.

In the archived issue linked above, this issue seems to have been fixed since 2.43.0, so it looks like there has potentially been a regression of sorts?

Does anyone else still experience this issue using the latest standalone server, 2.53.0?

Steps to reproduce

This would be to simply adjust your /etc/hosts file and put localhost in front of any other aliases, like so:

127.0.0.1       localhost   localhost.localdomain alias etc

Thanks, Emlyn

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:11 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
bkelley13commented, May 31, 2017

I see same issue sin 2.53.1 as well. The setPref doesn’t fix it for me, only modifying the /etc/hosts, yet since it is puppet managed, that’s ephemeral at best.

0reactions
diemolcommented, Sep 23, 2018

@pcooper19 the original issue was related to Firefox, if you are facing an problem with Chrome, please open a new issue with all the info required by the template.

Since no one has provided a way to reproduce the issue, and it is mostly related to Selenium versions < 3.0.0, I will close this issue. Feel free to reopen if a complete, step by step way to reproduce is provided.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Aliases in /etc/hosts for 127.0.0.1 causes a "Bad request" error
the test runs fine. The /etc/hosts file is Puppet managed across our infrastructure, but more importantly, it was correct in the first place:...
Read more >
"Virtual Host/WebGroup not Found" Error When Submitting ...
If localhost is used as an alias entry, check the etc/hosts file to ensure all host names (aliases) associated with the loopback address...
Read more >
Host/domain name problem in /etc/hosts and /etc/resolv.conf
"localhost" is the loopback interface, which is 127.0.0.1 and hardcoded by the TCP/IP software stack. Localdomain is a reserved domain name.
Read more >
windows - hosts file ignored, how to troubleshoot? - Server Fault
Go to your network connections properties, then TCP/IP settings, and change the first DNS server to 127.0.0.1 (localhost). The second should ...
Read more >
Why is my hosts file entry being ignored by the browser? [closed]
I mapped a website with the IP of www.facebook.com to load Facebook when I request a different url (let's say www.x.lk ) particular...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found