Please guide us for the below requirement to setup dynamic sitemap.xml in multi site app.
Below is the requirement,
When user accessing STOREFRONT_HOST/sitemap.xml then it should show the contents from API_HOST/rest/v2/localeUs/sitemap without changing browser URL.
If user access STOREFRONT_HOST/ca_en/sitemap.xml then it needs to show the contents from API_HOST/rest/v2/localeCa/sitemap
Likewise we have many locales. So we need dynamic configuration for this.
Storefront should show XML document instead HTML document when accessing sitemap.xml.
We thought to try from server configuration with proxy setup like below,
location = /sitemap.xml {
proxy_pass API_HOST/rest/v2/localeUs/sitemap;
}
location = sg-en/sitemap.xml {
proxy_pass API_HOST/rest/v2/localeSg/sitemap;
}
location = ca-en/sitemap.xml {
proxy_pass API_HOST/rest/v2/localeCa/sitemap;
}
But we have many environments, in that case API_HOST is different for each storefront environment.
If this is correct approach then how we can achieve this from CCV2 portal for different environments.
Or else please help us to have correct fix.