Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Proxied resources do not display in email client #80

Open
howardshand opened this issue Feb 19, 2025 · 6 comments
Open

Proxied resources do not display in email client #80

howardshand opened this issue Feb 19, 2025 · 6 comments

Comments

@howardshand
Copy link

Using CiviProxy with the current setup:
intranet site: intranet.com
proxy site: proxy.com

  1. emails received in mail client do not load images, and show links as intranet.com/image.jpg
  2. all non image/resource links (such as 'View in your browser') work and correctly show as proxy.com/link
  3. 'View in your browser' page correctly shows images with links such as proxy.com/image.jpg
    screencapture-2025-02-19-12_54_09.png
@bjendres
Copy link
Member

Thanks for reporting.

@pbatroff, does that ring a bell?

@pbatroff
Copy link
Contributor

Yeah, it looks like the proxy settings is not correct. could you please post the part with the path mappings?

This is from the config.dist file:

$target_rest      = $target_civicrm . '/sites/all/modules/civicrm/extern/rest.php';
// base URL for api4 calls. Will append entity and action path segments
$target_rest4     = $target_civicrm . '/civicrm/ajax/api4/';
$target_file      = $target_civicrm . '/sites/default/files/civicrm/persist/';
$target_mosaico   = NULL; // (disabled by default): $target_civicrm . '/civicrm/mosaico/img?src=';
$target_mosaico_template_url = NULL; // (disabled by default): $target_civicrm . '/wp-content/uploads/civicrm/ext/uk.co.vedaconsulting.mosaico/packages/mosaico/templates/';
$target_mail_view = $target_civicrm . '/civicrm/mailing/view';
$target_url       = $target_civicrm . '/civicrm/mailing/url';
$target_open      = $target_civicrm . '/civicrm/mailing/open';

The important part is the target_mosaico part, that needs to be enabled. That might already help

@MarcMichalsky
Copy link

MarcMichalsky commented Feb 20, 2025

We had a similar issue under Drupal when the language part was embedded in the URL:
https://civicrm.example.org**/en/**civicrm

In this case, the URLs for the images are not replaced correctly in the CRM_Civiproxy_Mailer.

@howardshand
Copy link
Author

This is it:

// default paths, override if you want. Set to NULL to disable
$target_rest      = $target_civicrm . '/wp-content/plugins/civicrm/civicrm/extern/rest.php';
// base URL for api4 calls. Will append entity and action path segments
$target_rest4     = $target_civicrm . '/civicrm/ajax/api4/';
$target_file      = $target_civicrm . '/wp-content/uploads/civicrm/persist/';
$target_mosaico   = $target_civicrm . '/civicrm/mosaico/img?src='; // (disabled by default): $target_civicrm . '/civicrm/mosaico/img?src=';
$target_mosaico_template_url = $target_civicrm . '/wp-content/uploads/civicrm/ext/uk.co.vedaconsulting.mosaico/packages/mosaico/templates/'; // (disabled by default): $target_civicrm . '/wp-content/uploads/civicrm/ext/uk.co.vedaconsulting.mosaico/packages/mosaico/templates/';
$target_mail_view = $target_civicrm . '/civicrm/mailing/view';
$target_url       = $target_civicrm . '/civicrm/mailing/url';
$target_open      = $target_civicrm . '/civicrm/mailing/open';

// CAUTION: use the following for CiviCRM < 5.27 or "Extern URL Style" = "Standalone Scripts" 
//$target_url       = $target_civicrm . '/sites/all/modules/civicrm/extern/url.php';
//$target_open      = $target_civicrm . '/sites/all/modules/civicrm/extern/open.php';

@MarcMichalsky
Copy link

MarcMichalsky commented Feb 20, 2025

emails received in mail client do not load images, and show links as intranet.com/image.jpg

I think this indicates that the matching is not working properly when the paths are replaced in the extension's mail hook.

@howardshand
Copy link
Author

Thanks @MarcMichalsky, I didn't realize that Mailing.php was using something hardcoded rather than pulling from config.php. I submitted a PR #81 to fix the issue with the hardcoded values for now but the better option may be to make it use the paths defined in the config.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants