How does an app access read the store configured App Proxy Url?

minsko
Shopify Partner
15 1 0

The documentation at: https://shopify.dev/docs/apps/online-store/app-proxies mentions that "Merchants can change the sub path or sub path prefix of app proxies.".  How can an app determine the current setting of the app proxy for that store?

For example:
Given a theme extension needs to read data from the proxied app.
The App is configured with:
Subpath Prefix: apps

Subpath: blah

The merchant installs the app and changes the configuration to:

Subpath Prefix: {storeurl}/tools

Subpath: halb

How does the theme code find the {storeurl}/tools/halb path it would need to POST to or GET from?

Replies 5 (5)
SBD_
Shopify Staff
Shopify Staff
1636 229 338

Hey @minsko,

 

I doesn't look like there's an API to determine which subpath a merchant selects. Changes would need to be done manually in your example.

Scott | Developer Advocate @ Shopify 

minsko
Shopify Partner
15 1 0

Can an API be added to get this information?  The only workaround I see would be for apps to add a new section to their administration pages asking the merchant to re-enter the customized path.

SBD_
Shopify Staff
Shopify Staff
1636 229 338

Hey @minsko 

 

Happy to send the feedback to the app proxy team. Can you elaborate on your use case? Say a merchant changed the sub-path, how would you use the information? Would you update the theme? and in this case could you do this programatically, or would you need to manually update?

Scott | Developer Advocate @ Shopify 

minsko
Shopify Partner
15 1 0

I am working on a theme extension that needs to contact the app server to get information to display to the user.  My understanding is this is one of the main reasons to use an App Proxy. The theme extension needs to know the path that will get proxied to the app server. By default, the theme extension uses the path defined for the app (/apps/blah).  If the merchant customizes the path (/tools/hlab), the theme extension will no longer be able to use the app proxy as it does not know the path that is proxied.  If this information was available to the app and theme extension, it could be used to programmatically determine the proxied path.


SBD_
Shopify Staff
Shopify Staff
1636 229 338

Thanks @minsko. Passing this along.

Scott | Developer Advocate @ Shopify