The admin interface handles FCGI requests incorrectly
- Dominant language
- C++
- Stars
- 18.7k
- Forks
- 3.1k
- Avg merge
- 1h 47m
- Merged PRs (30d)
- 2
Description
While working on setting up a monitoring-management virtual host for the admin interface, I discovered that the HHVM admin interface just considers the original url of the HTTP request in order to build a response, and not the FastCGI variables like SCRIPT_NAME et cetera.
This makes practically impossible to serve the admin interface under a mountpoint: if I do like follows (for example, using apache):
```
ProxyPassMatch ^/hhvm-admin/(.*)$ fcgi://localhost:9500/$1
```
and then try to see the help page:
```
curl http://localhost/hhvm-admin/
```
I get inexpectedly a 404 with a message "Unknown command: hhvm-admin/"
I traced this to method `AdminRequestHandler::handleRequest` in `hphp/runtime/server/admin-request-handler.cpp`: at line 122 I see that the `cmd` variable that will later be used as the command to execute gets assigned as follows
```
std::string cmd = transport->getCommand();
```
and the `transport->getCommand` method ends up calling `URL::getCommand()` which will (I guess, I had no time/ability to investigate further) operate on the HTTP_URL and not on the appropriate FastCGI variables, thus making any attempt at serving the admin interface in any way but with a dedicated VirtualHost vane.
Contributor guide
Assessment
This issue has not been assessed yet.