Honestly, I wouldn't expect to get any response about this. I have problems going back over 3 years which I've contacted Shopify about multiple times—through the forums, through support, and through twitter—and still they're not addressed. It might be more productive to write your question on a piece of paper and burn it.
If we do get an answer to this, I will happily eat my words :)
Ideally, we'd get a notification for a change in proxy url by the shop owner.
For now, I'd set a preference in your app defaulting to the proxy url you set, then let the shop owner change the that pref if they change their proxy url.
Would it be possible to get the proxy url from a request header in your proxy endpoint? (e.g., referer)
Edit: Nevermind. After the shop owner changes the proxy url, the old proxy url returns a 404 Not Found. How would your app receive a request with the new proxy url?? Silly me.
<del>Get the new proxy from the request params.</del>
Here's a sample log entry from a shopify app's web server receiving a proxy request:
shop: shop's myshopify_domain
path_prefix: the proxy url.
Keep the proxy url somewhere in your db — ideally a column in a model you already query upon proxy request. If path_prefix is different than the proxy url in your db, update it.
That's the best app developers can do for now.
Another vote to fix this problem. I think I may just put a warning on my app that says the app will break if they change the proxy URL.
I understand the rationale of allowing the store owner to set their own URL, but for some apps this doesn't make sense. The app developer should be able to toggle on/off whether the store owner can change it or not.
@Lucas, this is not a server side problem. It is all about the client. If the merchant changes the prefix, the client-side JS is useless.
So either Shopify informs an App of this change, so the App can then adjust the JS (clunky), or Shopify does away with a feature I bet NO ONE uses. Who really cares what the prefix is. My guess is that its a "You think they might need this, but they really don't" legacy.