Remix app proxy for POS UI Extension

I created a Remix app with the CLI and then created a POS UI Extension with the CLI. I want to make a call from the extension to the Remix app and return some data. Right now I’m just trying to get the connection to work in my local dev environment. From the documentation and some other posts it seems I have to set up an app proxy but the settings I’ve tried so far have failed.

In the partner admin app configuration:

Right now I’m testing by making a GET request with fetch() inside a modal from the POS UI Extension:

In the Remix app part I have a route named app.test.jsx where I’m listening for GET and POST requests via the loader and action functions:

I obviously don’t have this set up correctly and I’ve tried a few different things but I’m hoping someone here has done this before and can help me get this working.

Hey Greg!

Is there a particular reason you want to route your request through a App Proxy?
App Proxys are generally used to display content on your stores domain and not meant to provide endpoints for POS extensions.

In your POS extension you can just directly fetch your endpoint, no need to route through the app proxy.

const token = await api.session.getSessionToken();
setSessionToken(token);

const response = await fetch('https://your-current-cloudflare-url.trycloudflare.com/api/test', {
  method: 'GET',
  mode: 'cors',
  credentials: 'include',
  headers: {
    'Content-Type': 'application/json',
    Authorization: `Bearer ${token}`,
  },
});

Can you try this approach?

Best regards,

Kevin :hatching_chick:

When trying to directly fetch my endpoint with the URL like you suggested I get an error:

Maybe a CORS error?