Multiple Domains vs. Template Caching

Hello Everyone,

I have 1 single instance of ERPNext setup with two addon-domains. So I have my primary site let’s say https://mysiteA.com.

Then I added two additional domains via bench setup domain --site mysiteA.com mysiteB.com followed by mysiteC.com, so at the end both of these domains are just alias to mysiteA.com

I want all three of these sites to share the same backend and the front end is also very similar. The only thing that needs to change between the three domains is just the site name, and the brand logo.

I was able to make these modifications by checking frappe.get_url() in the required templates. The problem is, when I clear the cache whatever domain is visited first that site name and logo will appear for all three domains.

I’m thinking my approach to this might be incorrect. Does anyone have any thoughts how I can display just a different site name and logo based on domain?

I was able to solve this by modifying the core, adding the domain name into the cache key.
https://github.com/frappe/frappe/blob/ccb2ca088009bad0fb658b57039597ceb04d2678/frappe/utils/redis_wrapper.py#L21-L30

1 Like

Change the core will risk you losing the modification when updating frappe.
I think this is also useful to other users. Maybe you can send PR for the change? Thank you

1 Like

I’ll link the PR here when complete. I should still run some tests.