Maybe this is not solution for your problem, but try to setup reverse proxy.
I spend the whole day trying to find problem why goutte does not work with web server on port 8000.
After internal redirection goutte lose port in url. Finally I found workaround (maybe it’s solution?!?), I configured on my apache web server rewerse proxy to redirect http: //test/index-test.php to http: //localhost:8000/index-test.php.