Have your say in Community Polls: What was/is your greatest motivation to start your own business?
Our Partner & Developer boards on the community are moving to a brand new home: the .dev community forums! While you can still access past discussions here, for all your future app and storefront building questions, head over to the new forums.

Re: App Proxy Question

Solved

App Proxy Question

HunkyBill
Shopify Partner
4853 60 568

I know the pattern when I set up an App Proxy. For example, for my Shopify store https://jigglezoggle.myshopify.com I can have /apps/flooblefart as an endpoint, and Shopify will send my GET or POST to my App when I do an AJAX call to /app/flooblefart with (or without) data. I get back JSON or Liquid, my choice.

So let us say my DNS is mapping that *.myshopify.com name to https://www.excellentnews.com. If I make my JS calls to https://www.excellentnews.com/apps/flooblefart is that equivalent and acceptable practice?

I am seeing exactly that in a client shop, and it confuses me, and the FQDN is not something I ever considered using. Do most App Proxy calls use FQDN? If yes, why?

Custom Shopify Apps built just for you! hunkybill@gmail.com http://www.resistorsoftware.com
Accepted Solution (1)
Gregarican
Shopify Partner
1033 86 292

This is an accepted solution.

Actually, correction. I forgot to add my custom (real) domain name to the development store. Once I did that everything worked fine. The app proxy passed along things okay!

View solution in original post

Replies 5 (5)

Gregarican
Shopify Partner
1033 86 292

For grins I just tried this now for a test. And I received a middleman error from Cloudflare. Assuming on Shopify's side, since my app proxy receiver doesn't utilize this service.

403 Forbidden

cloudflare
Gregarican
Shopify Partner
1033 86 292

This is an accepted solution.

Actually, correction. I forgot to add my custom (real) domain name to the development store. Once I did that everything worked fine. The app proxy passed along things okay!

HunkyBill
Shopify Partner
4853 60 568

So strange but I accept that there are now two ways to work it. Thanks for confirming that!

Custom Shopify Apps built just for you! hunkybill@gmail.com http://www.resistorsoftware.com
dalwinder
Visitor
1 0 0

Hi, 

I am getting the same issue, I had fixed the 403 one but a new error occurred " refused to connect." so can you please help me fixing this.

thanks in advance

aidendev
Shopify Partner
51 1 0

So after revisiting old shopify proxy applications for a little over a year, there seems to have been an update when it comes to making POST requests to App Proxies. I've been getting the same 400 Bad Request errors specifically for POST requests only when trying to perform ajax calls to hit my app's backend methods:

   $.ajax({
       type: 'POST',
       url: '/apps/member-area',
       headers: {
           'X-Shopify-Access-Token': accessToken,
           'RequestVerificationToken': antiForgeryToken, 
           'Content-Type': 'application/json'

           
       },
       data: JSON.stringify(formData),
       dataType: 'json',
       beforeSend: function (jqXHR, settings) {
           console.log('Request URL:', settings.url);
           console.log('Request Type:', settings.type);
           console.log('Request Headers:', jqXHR.getAllResponseHeaders());
           console.log('Request Data:', settings.data);
       },
       xhr: function () {
           var xhr = new window.XMLHttpRequest();
           xhr.addEventListener('readystatechange', function () {
               if (xhr.readyState === 4) { // DONE
                   console.log('Response Headers:', xhr.getAllResponseHeaders());
                   console.log('Request Data:', xhr);
               }
           });
           return xhr;
       },
       success: function (response) {
           if (response.success) {
               $('#UserFeedbackMessage').text(response.message).css('color', 'green').show();
           } else {
               $('#UserFeedbackMessage').text(response.message).css('color', 'red').show();
           }
       },
       error: function (xhr, status, error) {
           console.error("Error updating collector info:", error);
           console.log("XHR:", xhr);
           console.log("Status:", status);
           console.log("Response Text:", xhr.responseText);
           $('#UserFeedbackMessage').text("An error occurred while updating your profile.").css('color', 'red').show();
       }
   });

Have you guys experienced this problem as well?