php - App Proxy downloading file instead of rendering liquid

326

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>
788

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,

https://mememe.myshopify.com/tools/fizbuzz or 
https://mememe.myshopify.com/community/altogether

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.

People are also looking for solutions to the problem: java - Error registering data from android to phpmyadmin

Source

Didn't find the answer?

Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.

Ask a Question

Write quick answer

Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.

Similar questions

Find the answer in similar questions on our website.