Fix missing port value across subdomains #293
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR fixes #208 by ensuring that the port for the current route/request is always appended when using Ziggy's
route()
function, even when building a route for a different domain.Serving an app on port
8000
and the domainziggy.test
, and given the following routes:In Laravel, we get this:
In a browser console using Ziggy, previously, we would get this:
This PR makes Ziggy's output match Laravel's, so that instead its output looks like this:
The change that caused this issue was introduced in #75, which added support for ports. That PR and the associated tests explicitly ensured that the port was not added unless the domain of the route being generated matched the current domain exactly. It's not clear to me why this functionality was set up that way, and after some research and testing I'm pretty sure it should actually work the way this PR demonstrates, so I updated that test as well to basically do the opposite of what it did before.
This is likely a breaking change and should not be released before v1.
See #75, #74, and laravel/framework#26247.