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

Full URL paths to templates should be relative to make it easier to deal with domain changes #410

Open
herbdool opened this issue Nov 23, 2020 · 5 comments

Comments

@herbdool
Copy link

I went down a rabbit hole trying to figure out why Mosaico was showing CORS errors after the client updated their default domain (using the raw domain instead of www.). Turns out just clearing CiviCRM cache and rebuilding Smarty templates isn't enough.

In the table civicrm_mosaico_template the metadata stores the full URL to the template. As far as I can tell there's no way to change that from the UI. Surely there's a better way to store the URLs so that sites can be moved to new domains or development/staging sites can be set up.

@seamuslee001
Copy link
Contributor

@herbdool as of I think 2.5 or maybe in the soon to be released 2.6 There is an API method to change the domains 43ad31e which can probably help here

@mattwire
Copy link
Collaborator

mattwire commented Jan 7, 2021

Closing following 2.6 release. Please reopen if still an issue

@mattwire mattwire closed this as completed Jan 7, 2021
@herbdool
Copy link
Author

herbdool commented Jan 7, 2021

Thanks for the update. I don't see it listed in the release notes but I assume it's there.

By the way, how do we trigger the urls getting fixed? Do we have to manually run the API? I see civicrm_api3_mosaico_template_replaceurls. I guess that's something, though I guess I was hoping for something that would be completely independent of the domain tld. For example, if I'm duplicating a site from live into a different environment like dev, it would be good for a developer not to have to go through a checklist of steps to ensure that everything is working. It should just work. But perhaps that's just not possible?

@mattwire mattwire reopened this Jan 7, 2021
@mattwire
Copy link
Collaborator

mattwire commented Jan 7, 2021

@herbdool I've reopened as it sounds like it's still an issue - we had 76 issues open which is pretty unmanageable :-)

@andyburnsco
Copy link

I believe the change to relative url's would also fix the CORS issue for people using Multisite? The only other alternative I see is enabling CORS for the discrete list of domains on the multisite. Not as good as as a solution and maybe that is not even advisable.

Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at https://example.org/wp-content/uploads/civicrm/ext/uk.co.vedaconsulting.mosaico/packages/mosaico/templates/versafix-1/template-versafix-1.html. (Reason: CORS header ‘Access-Control-Allow-Origin’ missing). Status code: 200.

krishgopi added a commit to krishgopi/uk.co.vedaconsulting.mosaico that referenced this issue Jun 7, 2022
mattwire added a commit that referenced this issue Jul 8, 2022
#410 - Multisite support for mosaico
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