Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

If "host" is set up for a route, then the port is not respected on route generation. #204

Open
ZeeCoder opened this issue Aug 10, 2015 · 6 comments

Comments

@ZeeCoder
Copy link

Suppose I have a local web server on port 8888, while my production server is on the standard 80.

Generating an absolute url with

Routing.generate('news', {}, true);

would generate a proper absolute url, like: "http://localhost:8888/news"

By having a specific "host" in the routing.yml configuration however does not behave like this.

For example, having the following yml config:

news:
    resource: "@AppBundle/Controller/NewsController.php"
    type: annotation
    host: %news.domain%

Where "news.domain" is a parameter set to "news.example.org" on the production server and to "news.localhost" on the local machine, generating routes results in the following:

Routing.generate('news');
Routing.generate('news', {}, true);

// Production results
// -> "http://news.example.org" // OK

// Local results
// -> "http://news.localhost" // Instead of the expected "http://news.localhost:8888"
@bnd170
Copy link

bnd170 commented Apr 18, 2016

I have the same problem, no way to do it in my local envoirment

@lenybernard
Copy link

same here 😿

@DerekRoth
Copy link

This seems to be the same issue as #167
Not only the port is not included in the generated URL but the host is always included even if it is the same as the current one.

@devFab
Copy link

devFab commented Aug 31, 2017

I still have the same issue. any update or way to fix it?

@andrewtch
Copy link

Same here (still)

@sarramegnag
Copy link

It seems like it is the same for schemes. If you specify host but not schemes, http is forced even if you access website through https.

# Generates right https urls
subdomain:
    resource: 'subdomain/routing.yml'
# Generates wrong http urls
subdomain:
    resource: 'subdomain/routing.yml'
    host: '%subdomain%'
# Generates right https urls
subdomain:
    resource: 'subdomain/routing.yml'
    host: '%subdomain%'
    schemes: [https]

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants