My Sitecore CD website in IIS is http://cd.my-website.com with a role as ContentDelivery. This site contains Sitecore and custom API code in Headless mode.
All sites are separate in IIS and also separate folders pointing to the same database on a local machine.
The sites are working fine except personalization. We have set some personalization based on custom rule and some OOB rules.
The personalization is not working when I access the site using the http://fe.my-website.com.
I checked very weird behavior for the below URL
When it is accessed through the FE website, the Layout service is called as an Ajax request and it can be found in XHR under network in the developer toolbar. The site is not showing any personalization when called in this way. Even I set some very basic OOB Sitecore personalization like date or day or month.
In XHR, I can find the call to the layout service. When I checked the response, I didn't find any personalized content. When I opened the same URL in the browser (right-click and open in new tab), I can see all personalization applied correctly. The output is different than the Ajax request.
When I deployed the React code in Sitecore site under /dist/myproject/ and tried to access personalization worked fine (Integrated mode).
Sitecore 9.1 initial release
License: xDB enabled
xDB settings: Default/No Change