Shopify app proxy never working for me

Highlighted
New Member
12 0 0

Hi guys:

     I'm sure this is a newbee question, but I just can't figure this out based on the official documentation.

     I have my first app up and running on a remote server, I have all the oauth done. I can access store data from my remote app now.

     My next step is to setup app proxy so I'm able to make ajax request from store frontend to my app backend for communication.

     Now, my conf in app dashboard is 

      Sub path prefix: app

      url: ajax

       proxy_url: http://app.myapp.com/ajax

 

       On my remote server, I have http://app.myapp.com/ajax/test/  returns a simple string back. (python backend, url tested to be working)

       When I'm access https://myshop.myshopify.com/apps/ajax/test.  It gives me 404.  I double check on my app server. No http request was received. Can anyone help me understand what's going wrong with this setup? I couldn't find anything to help me in the documentation.

       Thank you guys in advance.

 

0 Likes
Highlighted
New Member
12 0 0

Find a typo above. should be below

    Sub path prefix: apps

    url: ajax

    proxy_url: http://app.myapp.com/ajax

0 Likes
Highlighted
Shopify Staff
Shopify Staff
619 48 93

Hi Kelvin,

You are getting a 404 because https://myshop.myshopify.com/apps/ajax/test isn't a valid proxy page. You can set it to  https://myshop.myshopify.com/apps/ajax, but there can't be an additional slash at the end of your path. The path in the shop doesn't need to match the path in your app. Our documentation has some sample code you can reference.

Cheers,

0 Likes
Highlighted
New Member
12 0 0

Hi Busfox:

     Thanks for you reply.  What I got from the documentation is https://example-store.myshopify.com/apps/my-app-proxy/app_path

     In my config: 

      example-store.myshopify.com = https://myshop.myshopify.com

      my-app-proxy = ajax

       app_path = test

       What's the difference between the documentation and my example? https://myshop.myshopify.com/apps/ajax/test

0 Likes
Highlighted
Shopify Staff
Shopify Staff
619 48 93

Hey Kelvin,

You're absolutely right! I just tested it on my test app, and it should work with the third slash in the path. Can you let me know the shop and app name you are trying this with so I can take a look?

Assuming you have a route in your app at http://app.myapp.com/ajax/test, and the proxy page is set up properly in the admin of the shop you are using, you should be good.

0 Likes
Highlighted
New Member
12 0 0

Hi Busfox:

    Here's my app http://app.williamswitzer.com/ajax/test/ , which is working.

    Sub path prefix: apps

     Url:  ajax

    Proxy Url: http://app.williamswitzer.com/ajax

 

    Thank you for looking at this. What I'm expecting is https://william-switzer.myshopify.com/apps/ajax/test will forward http request to http://app.williamswitzer.com/ajax/test/ if I understand the documentation correctly.

 

0 Likes
Highlighted
Shopify Staff
Shopify Staff
619 48 93

It looks like the proxy page in your shop admin is setup at /apps/app rather than /apps/ajax. If I go to https://william-switzer.myshopify.com/apps/app/test, it works. You can update the address in your admin here:

0 Likes
Highlighted
New Member
12 0 0

This is so strange. I have screenshot attached. I've never use app as the url in conf..

 

0 Likes
Highlighted
New Member
12 0 0

Really appreciate your help. Finally, I know this is working!

 

0 Likes
Highlighted
New Member
12 0 0

Hi Busfox:

    Do you have any idea why this is happening. Would like to know for future development. Thanks a lot.

 

0 Likes