Proposal: setting to define alternative frontend URLs for when using a proxy
When CiviCRM runs behind another system, such as a reverse-proxy running on a separate domain that only exposes specific features, we do not have a way to define that URL.
For example:
- Staff access crm.example.org - the service is running behind a VPN and not available to the general public
- However, they send mailings, which include unsubscribe and opt-out links. This feature is provided by a reverse-proxy that forwards those requests specifically.
CRM/Mailing/BAO/Mailing.php defines a few URLs and uses CRM_Utils_System::url
to generate the links. In the example I found, they were overriding the core PHP file, in order to hardcode the domain.
I'm thinking mailing hook_civicrm_links might be a good semantic fit, even if it's a bit of an odd case, but it is used is weird places, such as in the Extension Manager.
-
op
=mailing.content.actions
? (mailing.actions could be confusing with actions in the UI, such as edit/delete) -
objectID
=job_id
?
Where it gets weirder, is that the array of $urls
would have to be packaged into the format that the hook expects, then unpackaged back into the expected format from the parent function (unless we just send it as-is, because the fluff is not necessary, and it's up to the hook to check for the $op
).
An alternative could be to add a special CIVICRM_UF_BASEURL
, but then it would mean more params for CRM_Utils_System::url
and it seems already messy enough.
Edit: based on Jaap's comment, it probably makes more sense to find a solution for a "reverse-proxy URL".