App Proxy Problem

AI-generated summary

App proxy requests were not reaching the custom app as expected. The setup used Shopify Online Store app proxy settings with:

  • subpath prefix: tools
  • subpath: fuzzywuzzy
  • proxy URL: https://myapp.ngrok.io/fuzzywuzzy

A test request to /tools/fuzzywuzzy returned an error/404, which initially suggested Shopify was not handling the proxy. One reply clarified the expected pattern: requests should go to the shop domain using only the configured prefix + subpath, while the backend proxy URL remains hidden; a screenshot of a working proxy configuration was shared as reference.

The issue was ultimately traced to the app backend, not Shopify. After inspecting the response, it became clear the app was blocking requests because it saw the mystore.myshopify.com host header and rejected it.

Outcome:

  • No Shopify-side configuration change was needed.
  • The failure was caused by backend host/header validation.
  • The problem was resolved once the real source of the rejection was identified.

For my Custom App, I access the Online Store aspect of Extensions and turn on App Proxy. I am careful here to set three things.

  1. I choose tools from the Subpath Prefix

  2. I set the Subpath to be fuzzywuzzy

  3. I set the Proxy URL to be https://myapp.ngrok.io/fuzzywuzzy

My App accepts incoming calls from Shopify at https://myapp.ngrok.io so I would expect the router to be triggered for a GET or POST to /fuzzywuzzy

I navigate to the merchant shop with this App installed. I open up any page and access the console. I find jQuery available so I do a quick $.get(‘/tools/fuzzywuzzy’) and Shopify returns me an error telling me I cannot access https://theshop.myshopify.com/fuzzywuzzy. Of course.. that is not a Proxied URL.

That tells me the App Proxy is not being handled by Shopify. Why? It is saved in the App, and should work. What else has to happen here to make the Proxy exchange with the backend?

Here is how I have my app proxy defined.

Then in my production system I call through it by hitting this URL → https://MY_SHOPIFY_SHOP.myshopify.com/apps/dch-webapi. As you can see, just the subpath prefix and subpath are appended to the Shopify shop’s URL. All of the Proxy URL stuff is hidden from the call. Does this help any?

Not sure why it would matter. the https://mystore.myshopify.com/tools/fuzzywuzzy fails 404 same as the standard /tools/fuzzywuzzy call I always use with all my other Proxy setups.

OK. So I inspected the response, in detail. It seems it was me the dummy. I forgot that the header would be mystore.myshopify.com and my App was set to block that, which is the actual response. My App telling me to screw off. Sigh… some things never get old, like App Proxies!