Why am I getting a CORS error or 404 with my Shopify app proxy?

You should point the proxy at a Remix route and not the server, so, for example:

app/routes folder:

app.api.jsx

Then the App Proxy URL would be:

[https://mydomain.trycloudflare.com/app/api](https://mydomain.trycoludflare.com/app)

Then your fetch() URL would be like:

/subpath_prefix/subpath

Which would actually be:

/apps/api

Note that, you don’t have to add the domain part of the URL, in the fetch() URL param.

Please remember that form POST requests, hit the:

Remix action() method

And GET requests, hit the:

Remix loader() method

Hi, I’m also having the auth login 404 error. Did you ever fix it?

Yes, I used https://remix.run/resources/remix-utils#cors and 404 is gone!

Oh nice thank you! I’ll try to implement cors. However, I may ask for help later if I can’t figure it out.

Can you explain how you got it to work? Been trying to implement cors but I’m unable to get past the /auth/login error.

It is something like this.


import { cors } from "remix-utils/cors";

import { json } from "@remix-run/node";

export const action = async ({ request }: ActionFunctionArgs) => {

const { session } = await authenticate.public.appProxy(request);
my logic...

return cors(request, json({status: 200}));

}

I still get the same error. I guess my issue is from something else. Thank you for helping out!