FriendsOfSymfony / FOSJsRoutingBundle

A pretty nice way to expose your Symfony routing to client applications.
1.48k stars 261 forks source link

Incorrect generation of URLs when no explicit host is passed #373

Closed danrot closed 4 years ago

danrot commented 4 years ago

We are using your bundle, and Version 2.5.2 breaks our application, because the URL is generated with the current host, but without the scheme. This results in a relative URL without a starting slash (e.g. example.org/test), and then the gets appended to the current URL, resulting in something like example.org/test/example.org/test, which is not a valid URL in our case.

We have already broken it down to the usage of window.location.host to set the base_url, and then generating the URL without the the scheme.

tobias-93 commented 4 years ago

Hi @danrot, I'm sorry for the inconvenience, I would think it would be solved if not the base_url would be set to window.location.host as fallback but the host should be set to window.location.host. What do you think? I may have overlooked this when merging #371. I will revert #371 and release a new version to mitigate the issue for now, and have a closer look later on. Regards, Tobias

danrot commented 4 years ago

Thank you for quickly handling this! And I don't know the codebase too well, if I am completely honest... So I don't really know where this default should actually go without breaking something :see_no_evil:

danrot commented 4 years ago

And by the way, there is the wrong commit referenced for 2.5.3 on packagist: https://packagist.org/packages/friendsofsymfony/jsrouting-bundle#v2.5.3

danrot commented 4 years ago

Oh, and I don't know how that will affect this feature, but you should also consider the port when implementing it again :slightly_smiling_face:

tobias-93 commented 4 years ago

And by the way, there is the wrong commit referenced for 2.5.3 on packagist

I tagged the wrong version when I was releasing 2.5.2, it has been corrected now. Thanks for the heads up. The fallback will be fixed in a new issue, I'm closing this issue.