App Proxy not rendering liquid?

AI-generated summary

Issue centered on how a Shopify App Proxy behaves when calling a proxy path like /apps/myproxy and forwarding it to an external URL. The main confusion was whether Shopify should keep the storefront URL visible or redirect the browser to the app server, and why returned Liquid markup was not being rendered.

Key points raised:

  • The proxy request appeared to redirect to the external endpoint, with Shopify parameters appended.
  • JSON responses worked fine for Ajax calls.
  • Returning Content-Type: application/liquid plus Liquid such as {{ shop.permanent_url }} did not initially render; in the browser it even triggered a file download.

Resolution:

  • The problem was ultimately solved by using an additional sub-path after the configured proxy path when making the browser request.
  • Shopify still proxied the request correctly and appended that sub-path to the destination URL.
  • Once that was done, the proxy behavior and Liquid rendering worked as expected.

Outcome: resolved; no open issue remained.

Hello!

I have set an App Proxy in my app like this:

apps/myproxy

And it forwards to an URL like:

https://mysite.com/workproxyrequest.php

This kinda works…

When I call in the browser:

https://<merchantshop>.myshopify.com/apps/myproxy?somestuff=abc

I get redirected in the browser (with the Shopify credentials appended to the URL) to:

https://mysite.com/workproxyrequest.php?somestuff=abs

Is this normal?

Is the URL in the browser not supposed to stay the same without redirecting the browser…

… while just displaying whatever (mysite.com/workproxyrequest.php) returns as content?

Anyway…

This is fine for doing Ajax calls.

I can send data to the proxy URL at (https://.myshopify.com/apps/myproxy) and get json data back from my app and insert it on the merchant’s page via JavaScript.

Rendering Liquid code…

Am quite lost here…

I’ve tried:

On my app, I’ve the response header to be ‘Content-Type’ => ‘application/liquid’.

Then my app returns some content like “This shop is located at: {{ shop.permanent_url }}”, but that Liquid code in that string never gets rendered. And if I call the proxy URL via the browser, the browser asks me to download the page, when the header content type is set to ‘application/liquid’ and does not display anything. And whatever is downloaded still does not have any Liquid code rendered.

The same via Ajax…

I get the content that my url returns, but Liquid code does not get rendered…

Seems like I’m missing how the Liquid rendering is supposed to work…

Can you help me understand it?

Thanks!

This is SOLVED!

It is working as expected.

I didn’t realize that to the path we define in the proxy we can append another sub-path when calling it in the browser and it will still proxy the call to the destination URL with that sub-path appended. When I started doing that, the rest seemed to work as expected.