Open Bibendus83 opened 4 years ago
Hi there,
This is a known issue and is something that is simply not supported in the package at this moment. We really work with URL's and not with ports.
@ArlonAntonius but the port is part of URL...
@webard FQDN != URL
but we are talking about the url()
helper so it should contain a full URL not only the FQDN
Hi @Bibendus83,
Tenant's have an FQDN that is used for the URL and is excluding a port. This is something that is known and it's simply not something that we support at this moment.
It's not a question of supporting it or not, using this setting causes an error on the default laravel helper. Shouldn't it be fixed?
What exactly is the error? Could you provide a stacktrace? What is the fqdn set for the tenant?
I have a few thoughts on this. I definitely understand where @Bibendus83 is coming from. It's not necessarily that the functionality is "wrong" as much as it's "counter-intuitive"
In general, modern websites/webapps really shouldn't live on any port other than 80/443. If you need to (for the sake of supporting multiple sites/apps on the same host, then that can easily be done with domain-based vhosts in the webserver(apache/nginx/etc) instead of by port. The backend(php/laravel) layer of your application shouldn't care what port it's running at. The exception to this is if you're attempting to distinguish your tenants by port number, but that doesn't appear to fit your requirements (and is honestly a pretty terrible idea in general).
Having said that, I don't entirely disagree with @Bibendus83. If we claim to support dynamically updating the app-url config, then we should only replace the portion of it that corresponds to the FQDN (i.e. leave any provided/configured port alone). We should be able to dynamically support these kinds of use-cases.
Of course in production port 80/443 will be used. My main issue is that I wasted a couple of days to understand what was the cause of the problem on my dev environment. By default my docker environment runs on port 8000 (and I can't change it because I'm running another apache service on 80), so I could access my site only using that port (ex. http://www.mysite.dev:8000). However all internal links that laravel was creating where without the :8000 part, causing problems with direct links, login pages, etc. So what I ask is, if the site is originally hosted on a different port from 80/443, why should it be forgotten while forcing the FQDN?
I would add that I had some issues with email notifications sent by jobs.
To fix the problem I had to enable the update-app-url
setting, however it breaks all links in my dev environment.
That's why I created PR #951 to fix it.
I have my dev environment working on a port different from 80/443. If I set
update-app-url
intenancy.php
to true all myurl()
helper calls return the url without including the port. CheckingHyn\Tenancy\Listeners\URL\UpdateAppUrl
force() method I noticed that the url rewrite does not include the port$url = sprintf('%s://%s', $scheme, $hostname->fqdn);
Shouldn't the port be included?