How to trigger default theme 404 page in Proxy App?

How to trigger default theme 404 page in Proxy App?

savchukoleksii
Shopify Partner
9 0 16

Hi! Is anyone have solution for this problem. I think it will be great if route in your Proxy App is 404 to display the default 404 template from theme. I try to send 404 headers but nothing, also try to define `template` value in Liquid response, but also nothing. 
Possible solution also to get 404 from theme files and save in app and watch for changes, but it also tricky way, because then you will use Preview Mode you can not understand which theme you show without Javascript.

Replies 4 (4)

Alex
Shopify Staff
1561 81 342

I'm not much of a liquid expert so bear with me. While I don't think you can explicitly set the 404 template on your return value, you could instead return this:

<h1>{{ 'general.404.title' | t }}</h1>
<p>{{ 'general.404.subtext_html' | t }}</p>

The above is the contents of a 404.liquid template file in my theme. When given via an app proxy, it looks to render that very 404 through the proxy neatly. Is that what you're talking about when you say Possible solution also to get 404 from theme files and save in app and watch for changes? I don't really have a solution to the issue of making sure you're totally in sync with the current theme's version of a 404 unless of course you poll for it periodically. I hope that helps at least a little bit.

 

Cheer.

Alex | Shopify 
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Mark it as an Accepted Solution
 - To learn more visit the Shopify Help Center or the Shopify Blog

savchukoleksii
Shopify Partner
9 0 16

Return value is not variant, because different stores can use different html in their 404 pages. And even the different themes can use different 404 layouts. I think it need to be done Shopify. And the Shopify Proxy API devs must provide to us solution that will be fully supported by Shopify.
How I see it: 
If app response with status 404 than Shopify backend render 404 template from current theme.

Alex
Shopify Staff
1561 81 342

That's a sensible expectation. While it isn't currently the way the proxy implementation works, I can pass that feedback on to the team(s) responsible.

Alex | Shopify 
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Mark it as an Accepted Solution
 - To learn more visit the Shopify Help Center or the Shopify Blog

savchukoleksii
Shopify Partner
9 0 16
I have several ideas to share, that will be great if team do that for developers. It will make our life easier. This is only one thing