Display dynamic store data with app proxies
App proxies take requests to Shopify links, and redirect them to external links. This allows you to fetch and display data on a merchant's store from an external source.
You don't need to set up app proxies before publishing an app. If you add an app proxy to an app after you've published it, then existing installations of the app are updated automatically. You can configure the URL to which a request is forwarded at any time in the Partner Dashboard, meaning you can change the URL without needing to update the URL in any online stores.
Add an app proxyAnchor link to section titled "Add an app proxy"
- From your Partner Dashboard, click Apps.
- Click the name of your app.
- Click App setup.
- Navigate to the App proxy section.
- In the App proxy section, select a prefix from the Subpath prefix drop-down list.
- Enter a sub path in the Subpath field:
These settings determine which HTTP requests to Shopify are proxied to the proxy URL entered in the next step. For example, if the sub path prefix is
apps, and the sub path is
store-pickup, then any path in your online store after
https://johns-apparel.myshopify.com/apps/store-pickupwill be proxied to the provided proxy URL.
Enter the URL of your proxy server in the Proxy URL field. This is the URL that will be proxied from the path that you entered in the previous step.
When you're done, click Save.
Consider the following app proxy configuration:
- Sub path prefix:
- Sub path:
- Proxy URL:
In this example,
https://johns-apparel.myshopify.com/apps/my-app-proxy/app_path forwards to the proxy URL at
https://my-app-proxy.com/app_proxy/app_path. Subsequent child routes included in the request are forwarded as well, so
https://johns-apparel.myshopify.com/apps/my-app-proxy/child-route is forwarded to
The merchant experience of an app proxyAnchor link to section titled "The merchant experience of an app proxy"
Merchants can change the sub path or sub path prefix of app proxies. Merchants change the sub path prefix by toggling between a set of values provided by Shopify (
/tools). The combination of sub path prefix and sub path defines where the app proxy is accessed from a merchant's shop. Merchants can change this information to get a friendlier URL that appears to originate from the merchant's domain. The sub path doesn't affect the location of the proxy URL that you provide in the Proxy URL field.
Handling proxy requestsAnchor link to section titled "Handling proxy requests"
The following examples show an app proxy definition:
- proxy URL:
- client IP:
- shared secret:
When the following HTTP request is sent from the client, Shopify forwards the request using the specified proxy URL:
The forwarded request looks like the following:
The forwarded request adds the following parameters:
myshopify.comdomain for the shop.
path_prefix: The proxy sub-path prefix at which the shop was accessed. In this case, it's
/apps/awesome_reviews, which was replaced in the forwarded request URL with the proxy application's Proxy URL.
timestamp: The time in seconds since midnight of January 1, 1970 UTC.
signature: A hexadecimal encoded SHA-256 HMAC of the other parameters, split on the "&" character, that is used to verify that the request was sent by Shopify. The signature is unencoded, sorted, concatenated and uses the application's shared secret as the HMAC key.
Both the request method and request body are forwarded, meaning that content from form submission and AJAX requests can be used in the proxy application. If this is the case, then the URL still contains the query parameters added by the proxy (
signature), even when the body also contains URL encoded parameters.
Calculate a digital signatureAnchor link to section titled "Calculate a digital signature"
To verify that the request came from Shopify, you need to compute the HMAC digest according to the SHA-256 hash function and compare it to the value in the
signature property. If the values match, the request was sent from Shopify.
Below is an example in Ruby to calculate the digital signature:
Disallowed headersAnchor link to section titled "Disallowed headers"
Due to security concerns, the following headers are stripped from app proxy requests and responses:
Liquid responseAnchor link to section titled "Liquid response"
App proxies support Liquid, Shopify's template language. An app proxy response that contains Liquid will be rendered with store data into HTML like it was part of the store's theme.
If the HTTP response from the proxy URL has
Content-Type: application/liquid set in its headers, then Shopify renders any Liquid code in the request body in the context of the shop using the shop's theme. Otherwise, the response is returned directly to the client. Also, any 30x redirects are followed.