When calling:
$this->get('router')->generate('...',array(),true)
To get an absolute URL from a controller I get a URL with default Port 80: https://subdomain.mydomain.com:80
How can I get rid of the :80? This only happens in production. On my local machine I don't get the default port in the absolute URL.
Production environment uses a reverse proxy (nginx:443->varnish->apache:80) The local apache server port is 80 but should be the remote Port 443.
btw this has been fixed in Symfony 2.3.5 https://github.com/symfony/symfony/commit/65814bae27d6fdb9501a4efd07e6b980353d89bb
You should check: https://github.com/symfony/symfony/blob/master/src/Symfony/Component/Routing/Generator/UrlGenerator.php#line-244, it might be the cause of your problem.
It's also possible it's a caching issue, try debugging using:
$this->context->getHttpPort() / ->getHttpsPort()
You can also fix this by defining the router context in the parameters.yml file like so:
router.request_context.host: localhost:8181
router.request_context.scheme: http
router.request_context.base_url: /application/path
This will let you generate correct URLs when there is no web context, like in commands or cron jobs.