#3525 - $util.url is naive

Identifier #3525
Issue type Feature request or suggestion
Title $util.url is naive
Status Completed
Handling member Salman
Addon General / Uncategorised
Description This URL puts on the full base URL.

We very rarely want to do that, because this will break AJAX scripts if running across multiple domains (unless crossdomain config works well, which I don't want to assume).
If running across multiple domains if possible we want our AJAX script to come from our own domain. Composr makes all URLs available from all domains, it is only the full page requests which are modified to assume a certain zone is running. $BASE_URL_NOHTTP will produce a relative base URL. E.g. if running on http://example.com/composr, it will return "/composr".

I suggest changing it to use $BASE_URL_NOHTTP. Then for the very rare cases where that won't work, explicitly pass $cms.getBaseUrl().

Btw, is there some technical reason the function is using {$BASE_URL} right now rather than $cms.getBaseUrl() internally? Probably, but if not, fix that too (but using $cms.getBaseUrlNohttp() of course).

I know this is a bit weird and complex, but we need to support these more complex configurations.
Steps to reproduce

Funded? No
The system will post a comment when this issue is modified (e.g., status changes). To be notified of this, click "Enable comment notifications".

Rating

Unrated