I am working on setting up integration testing of our Phoenix-application using Hound. I encountered a very strange error, which is that when using PhantomJS as Hound browser driver, Cowboy will reject all incoming connection with an ‘error 400’.
Searching the internet I found out that other people had a similar problem with Cowboy as well: PhantomJS does not by default seem to add a Host:
-header to the requests it does, which is against the HTTP spec and rejected by Cowboy (as well as happily accepted by most other webservers).
Switching to Selenium+Firefox instead of PhantomJS and everything works fine.
So just a heads-up that this issue exists. I’m not sure how this could/should be resolved; what would be the best approach?
- Ask the developers of PhantomJS to alter its default settings so it follows the spec.
- Update Hound so it requests PhantomJS to set a
Host:
-header when connecting. - Update Hound so it has the possibility to add custom HTTP headers from your own code.
- Ask the people behind Cowboy to create a way to accept requests with missing
Host:
-headers.