portal.componentUrl({ proto: https })

We are doing some dynamic loading of content on our HTTPS site.
The url used comes directly from portal.componentUrl
Since portal.componentUrl does not know that the site is HTTPS it uses http not https (as it should).

We have configured our proxy server to set the X-Forwarded-Proto header, so I can do this:

const proto = request.headers && request.headers['X-Forwarded-Proto'] || 'http';

Instead of doing string replace in js, it would be nice if componentUrl supported a “proto” option.

I guess that would be nice for all url methods.

Maybe they could respect the X-Forwarded-Proto header, but I don’t know what side-effects that might cause.

http://repo.enonic.com/public/com/enonic/xp/docs/6.9.0/docs-6.9.0-libdoc.zip!/module-lib_xp_portal.html#.componentUrl

Turns out this is only valid when type: 'absolute'. Which is not too often.

We should definetly be able to add this x-proto handling to the url functions!