-
Notifications
You must be signed in to change notification settings - Fork 11.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
url helper not picking the base root from the config setting #17385
Comments
The base URL is auto detected, it's not meant to be picked from the config file. I'm using valet now but I don't think I ever had any problem with ports when I was on Homestead, it used to pick it up with no problem, it's also strange that it works from within a controller but not a listener. |
I guess this is a queued listener. Fix will be to make it not queued, and only the queue sending part, after the content has been computed. If you're rendering a view to do that, you'll need to upgrade to L5.4, because it renders the view before queuing, unlike 5.3, (I think, you'll need to check this in the laravel source code). |
@GrahamCampbell nope, not queued. So it's a different bug. Try to reproduce and you'll see it too. |
@amosmos any progress on this? |
No, nothing really changed... The route() function is based on symphony's prepareBaseUrl which just misses the port when the call is from a service provider. You can just reproduce it and see it too... I don't know how to fix this... |
Can you try what i posted #14139 ? |
@amosmos , alternatively you can replace |
Anyone managed to fix this issue? |
Description:
When using the url helper, the root is calculated by symfony and not picked up according to the APP_URL env variable.
I found out about it when I was trying to use the url helper in an email notification which was sent based on an eloquent event listener (placed in a service provider) while running the app on homestead. The helper didn't pick up the 8000 port. After checking it I noticed the helper is using the request root function which is calculating the root based on a prepareBaseUrl symfony function (look here: https://github.com/laravel/framework/blob/5.3/src/Illuminate/Http/Request.php#L87, while the getBaseUrl is calling prepareBaseUrl), and that function somehow miss the port number in this specific call (from a service provider). So even when I manually set the 8000 port on the APP_URL env variable, nothing changed.
Note - when the email notification was called regularly from a controller, the port was received correctly. It only happened to me when the notification was called from a service provider.
Also, I believe on production there shouldn't be a problem as you don't need a special port like when using homestead.
Steps To Reproduce:
The text was updated successfully, but these errors were encountered: