php - App Proxy downloading file instead of rendering liquid
I'm building an embedded app and trying to get the App Proxy option to render a liquid page to work. I have set up the proxy correctly in the app, and have the file returningContent-Type: application/liquid
header, but when I access the page in my test store, it simply downloads the file.
I'm using laravel-shopify from this repository I have setup correctly app proxy in shopify but problem is that always download the proxy file
I host my project in a Digital Ocean Server
Any idea, thanks a lot !
Here's the original contents of thepublic/.htaccess
file in laravel:
<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
Options -MultiViews -Indexes
</IfModule>
RewriteEngine On
# Handle Authorization Header
RewriteCond %{HTTP:Authorization} .
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
# Redirect Trailing Slashes If Not A Folder...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} (.+)/$
RewriteRule ^ %1 [L,R=301]
# Handle Front Controller...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
</IfModule>
Answer
Solution:
Are you doing an XHR GET instead of hitting the App Proxy in Shopify?
When you want to return Liquid you initiate a GET at the proxy. So for example,
If you are instead making an XHR call to your endpoint, then obviously, even if you return liquid, you are returning data and in this case, your browser is telling you "hey, I don't know this, so I will initiate a download for you".
Try hitting the endpoint as a browser request and see what happens.