New Shopify Certification now available: Liquid Storefronts for Theme Developers

App Proxy not rendering liquid?

Mets
Shopify Partner
12 0 4

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://<merchantshop>.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!

 

 

 

Reply 1 (1)
Mets
Shopify Partner
12 0 4

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.