portal.assetUrl HTTPS protocol

Enonic version: 6.5.1
OS: Mac and linux

Currently our site is served in https.
However portal.assetUrl(type: ‘absolute’) produces http not https urls.
Have we forgotten to configure something with regards to Enonic?

Or should the “proxy” in front of Enonic have some kind of filter to rewrite documents urls? (sounds wrong to me)

Hi,

The proxy in front of Enonic XP should set the header “X-Forwarded-Proto”

These sorts of questions frequently came up for Enonic CMS, so they will likely also be asked frequently for Enonic XP. Perhaps the docs should get a brief page with tips regarding HTTPS-related setup, such as on the page for Operations Guide -> Configuration? And perhaps links to this page on all docs for functions that use the relative vs. absolute distinction.

2 Likes

First thinkg - the absolute setting should only be used for “off site” url’s, i.e. links inside an rss feed or similar.
In these cases, XP will use the protocol used by the server, when running a proxy this must properly forward protocol info as @gri comments.

In this instance part of our site (menu, footer, etc) is being used as decorator on other domains, mobile apps etc. That is the reason type: ‘absolute’ is used. So there might be instances where type: ‘absolute’ is used that you did not think of… and either way that’s beside the point.

I will check whether X-Forwarded-Proto is set to https.
I will check whether the request coming to Enonic contains https in any way.

I do want to use type: ‘server’ as default, and rather use a response filter to convert relative to absolute for the odd case of decorator.
http://xp.readthedocs.io/en/stable/developer/site/filters.html