Page MenuHomePhabricator

Internal Server Error if custom "Host" header is set
Closed, DuplicatePublic

Description

If I curl Phabricator with the Host header set to some non-existent domain, then I get an Internal Server Error:

> curl -I https://phabricator.example.com -H 'Host: foobar.com'
curl: (22) The requested URL returned error: 500 Internal Server Error

The error in the PHP logs:

[11-Aug-2014 03:12:35 UTC] [Core Exception/Exception] Specified domain foobar.com is not configured for Phabricator requests. Please use https://phabricator.example.com to visit this instance.

#0 /usr/src/phabricator/webroot/index.php(70): AphrontApplicationConfiguration->buildController()
#1 {main}
[11-Aug-2014 03:12:35 UTC] PHP Fatal error:  Uncaught exception 'Exception' with message 'AphrontWriteGuard was not properly disposed of! Call dispose() on every AphrontWriteGuard object you instantiate or use phutil_exit() to exit abruptly while debugging.' in /usr/src/libphutil/src/aphront/writeguard/AphrontWriteGuard.php:280
Stack trace:
#0 [internal function]: AphrontWriteGuard->__destruct()
#1 {main}
  thrown in /usr/src/libphutil/src/aphront/writeguard/AphrontWriteGuard.php on line 280

I don't think that a 500 is the appropriate HTTP response ehre.

Event Timeline

joshuaspence raised the priority of this task from to Needs Triage.
joshuaspence updated the task description. (Show Details)
joshuaspence added a project: Phabricator.
joshuaspence added a subscriber: joshuaspence.

Actually, I'm just going to merge this there and note it. If you have some technical reason to not want a 500 before then, I'm happy to accept a patch. This should probably be a 400, with better page content (listing available hosts, unless we can come up with security reasons not to do that).