Hi, this question was asked before, but was never answered. I'm creating an app that uses an applicaiton proxy link. I need to be able to reference this link for AJAX calls, but I cannot rely on the link matching what I set up in my app settings since store owners have the option to edit the url that they use. How can I access the url value that a store is using for my app?
Store owners may choose to change the sub-path so that the URL in the location bar makes the proxy page appear like it is being hosted in their store instead of externally. Ultimately, the sub-path is purely for shop aesthetics and will not affect the actual location of the proxy URL (edited sub-paths will still be forwarded to the proxy URL).
As I create the same pattern as Mr Mackay here I have the same issue. I can set up my App Proxy to work perfect, as /tools or /apps or /a or /community. But as soon as the merchant changes from one to the other, all the JS in the theme no longer points as the right address.
Either you allow the merchant to change URL and allow that change to propagate through a Liquid parameter (if possible), or you send an alert to the App via a webhook so it can re-inject new script code that works with the change.
Leaving the current App Proxy in this state degrades the use case possibilities severely for any App Proxy installed in a general App.
Another cool thing is that if your App is sending back JSON responses, you can incorporate liquid logic into the response. Based on Andrew's comment at the end of this forum thread, I've been using this ability in an app that I'm developing to verify that each request was made by a logged in customer. If someone were to try to access data from someone else's account by guessing their account ID, the JSON response would be returned as an error message after filtering through the liquid parser.