I've used Shopify-CLI to generate an app and I've configured the app proxy as:
Prefix: tools
Subpath: sb
Proxy: https://xxx.ngrok.io/sb
In the theme.liquid page, I'm trying to access this as:
var xhttp = new XMLHttpRequest();
xhttp.onreadystatechange = function() {
if (this.readyState == 4 && this.status == 200) {
// Typical action to be performed when the document is ready:
var response = xhttp.responseText;
console.log("Sb ok"+ response);
}
};
xhttp.open("GET", "/tools/sb/sessions", true);
xhttp.send();
I'm able to hit https://xxx.ngrok.io/sb/sessions on my browser and get a valid response.
But the AJAX request constantly giving me a 404 on my test store. I've been able to configure an app proxy successfully using a different test app, and the only difference is this is a public app while the previous one was a custom app. I initially had a conflicting config i.e. /a/sb for both apps, but I've tried changing it to /a, /apps, /tools, with and without the subpath with no luck. I've even deleted the previous app to avoid any unexpected conflicts.
Thanks in advance!