Shopify App - Embedded App Navigation Bar adding trailing slashes to links, makes Next.js 404

I fixed this issue by adding generic solution to my server.js.> > I am intercepting the request and remove the “/” except home or index route in embedded app. So I think this is generic way to resolve issue for all routes to fix this problem.

    router.get('*', verifyRequest(), async (ctx) => {
        if (ctx.url.slice(0, 2) != "/?") {
            ctx.url = ctx.url.replace("/?", "?");
        }
        await handle(ctx.req, ctx.res);
        ctx.respond = false;
        ctx.res.statusCode = 200;
    });

Let me know if any issue or problem, Thank you.