FriendsOfSymfony / FOSJsRoutingBundle

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

router.js sets window.location.host as base url causing router to generate wrong values. #376

Closed shinyvision closed 4 years ago

shinyvision commented 4 years ago

On line 70 of router.js, you'll find the following code:

this.setBaseUrl(data['base_url'] && data['base_url'].length > 0 ? data['base_url'] : window.location.host);

This causes the router to generate a route such as subscription-management.local/lockscreen/info (in my case), when it should have been /lockscreen/info. Also generating an absolute URL will not work, because it will put the request host in the result twice. (http://subscription-management.localsubscription-management.local/lockscreen/info)

This is undesired behavior. This can be fixed by replacing line 70 of router.js with the following:

this.setBaseUrl(data['base_url'] && data['base_url'].length > 0 ? data['base_url'] : '');
tobias-93 commented 4 years ago

Hi @rachel-fizz, Thanks for reporting this issue, but it is a duplicate of #373. As such, it has been fixed in version 2.5.3. Please try that version first, and let us know should you run into other issues. Kind regards, Tobias

shinyvision commented 4 years ago

Apologies. composer info was reporting the version to already be on 2.5.3, but for some reason the files were outdated. Thanks for the quick response anyway :)