What's your biggest current challenge? Have your say in Community Polls along the right column.
Our Partner & Developer boards on the community are moving to a brand new home: the .dev community forums! While you can still access past discussions here, for all your future app and storefront building questions, head over to the new forums.

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

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

minsko
Shopify Partner
28 3 6

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 6 (6)

SBD_
Shopify Staff
1831 273 421

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
28 3 6

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
1831 273 421

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
28 3 6

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
1831 273 421

Thanks @minsko. Passing this along.

Scott | Developer Advocate @ Shopify 

carloscrespo
Shopify Partner
6 0 2

Any improvements for this scenario. I have been struggling quite a long time with this problem. The only workaround seems to prompt the merchant to add the proxy URL somewhere in my App so I can store/udate in an app metafield that can be read by my theme extension's liquid.

 

Its a long path and not an ideal one to force the merchant to remember changing the proxy URL in the app config when it changes...

 

Any webhooks that fire when this config is changed? Any GrapQL API query/mutation to manage proxies?

 

Thanks a lot!