I am using magento 1.9 and I have a page in which as soon as it loads I fetch a controller API to get some product data.
The problem is that this request is being redirected to homepage in some devices. (Iphone devices that access the website through the Instagram integrated browser)
During my research I found out that this may be an issue related to the validation of the USER Agent. Magento redirects to homepage any request that do not have an user agent set or that may have changed. I think instagram on these iphones are not sending this header or either the header is changed or not being set fast enough before the fetch call (?).
What is the most recommended way to fix this? I could deactivate User agent check, but how about security? I've read that fetch does not always allow to set an user agent manually, but this would also be an issue, since I'd need to change it for every API call, otherwise one or another would get redirected.
Any help or advice are welcome.