Closed ondrejbouda closed 5 years ago
Could you create a test for this to show it failing? From a quick reread of the code, we should already be handling ports as part of $_SERVER['HTTP_HOST']
. Specifically, if HTTP_HOST
ends in a port, we split it away from the hostname and set that port as the actual port to use:
https://github.com/Nyholm/psr7-server/blob/4d037683112c0915b87739f052b651e4d6edeb8b/src/ServerRequestCreator.php#L256-L257
Great, it seems to be resolved by pull request #26 . I was using version 0.3.0 without this fix. I will use master for now.
Can you release a new Version with this fix? Had this issue in a project using your library.
Hi!
I am getting wrong URI when running on localhost with custom port:
GET http://localhost:8000/
The problem is probably due to mechanism used to create URI in
ServerRequestCreator::createUriFromArray()
. URI host gets populated with$_SERVER['HTTP_HOST']
, but this contains also the port (see for example here: https://stackoverflow.com/a/12046836 ).I propose two solutions:
$_SERVER['HTTP_HOST']
$_SERVER['SERVER_NAME']
instead - I am not sure about the consequencesI may create a pull request with fix if you want.