Skip to content

Instantly share code, notes, and snippets.

@WebCloud
Last active July 14, 2025 21:04
Show Gist options
  • Select an option

  • Save WebCloud/df8b789e74b90709d5b1e454020f0260 to your computer and use it in GitHub Desktop.

Select an option

Save WebCloud/df8b789e74b90709d5b1e454020f0260 to your computer and use it in GitHub Desktop.

Revisions

  1. WebCloud revised this gist Jul 14, 2025. 1 changed file with 32 additions and 30 deletions.
    62 changes: 32 additions & 30 deletions next.config.mjs
    Original file line number Diff line number Diff line change
    @@ -11,36 +11,38 @@ const nextConfig = {
    },

    async rewrites() {
    return [
    // Test rewrite - simple case
    {
    source: "/test",
    destination: "/api/ping",
    },
    // OAuth routes
    {
    source: "/oauth/:path*",
    destination: "/api/oauth/:path*",
    },
    // OAuth register route (special case)
    {
    source: "/register",
    destination: "/api/oauth/register",
    },
    // Well-known OAuth endpoints
    {
    source: "/.well-known/oauth-authorization-server",
    destination: "/api/.well-known/oauth-authorization-server",
    },
    {
    source: "/.well-known/oauth-authorization-server/:path*",
    destination: "/api/.well-known/oauth-authorization-server/:path*",
    },
    {
    source: "/.well-known/oauth-protected-resource",
    destination: "/api/.well-known/oauth-protected-resource",
    },
    ];
    return {
    beforeFiles: [
    // Test rewrite - simple case
    {
    source: "/test",
    destination: "/api/ping",
    },
    // OAuth routes
    {
    source: "/oauth/:path*",
    destination: "/api/oauth/:path*",
    },
    // OAuth register route (special case)
    {
    source: "/register",
    destination: "/api/oauth/register",
    },
    // Well-known OAuth endpoints
    {
    source: "/.well-known/oauth-authorization-server",
    destination: "/api/.well-known/oauth-authorization-server",
    },
    {
    source: "/.well-known/oauth-authorization-server/:path*",
    destination: "/api/.well-known/oauth-authorization-server/:path*",
    },
    {
    source: "/.well-known/oauth-protected-resource",
    destination: "/api/.well-known/oauth-protected-resource",
    },
    ],
    };
    },
    };

  2. WebCloud created this gist Jul 14, 2025.
    47 changes: 47 additions & 0 deletions next.config.mjs
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,47 @@
    /** @type {import('next').NextConfig} */
    const nextConfig = {
    eslint: {
    ignoreDuringBuilds: true,
    },
    typescript: {
    ignoreBuildErrors: true,
    },
    images: {
    unoptimized: true,
    },

    async rewrites() {
    return [
    // Test rewrite - simple case
    {
    source: "/test",
    destination: "/api/ping",
    },
    // OAuth routes
    {
    source: "/oauth/:path*",
    destination: "/api/oauth/:path*",
    },
    // OAuth register route (special case)
    {
    source: "/register",
    destination: "/api/oauth/register",
    },
    // Well-known OAuth endpoints
    {
    source: "/.well-known/oauth-authorization-server",
    destination: "/api/.well-known/oauth-authorization-server",
    },
    {
    source: "/.well-known/oauth-authorization-server/:path*",
    destination: "/api/.well-known/oauth-authorization-server/:path*",
    },
    {
    source: "/.well-known/oauth-protected-resource",
    destination: "/api/.well-known/oauth-protected-resource",
    },
    ];
    },
    };

    export default nextConfig;
    32 changes: 32 additions & 0 deletions vercel.json
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,32 @@
    {
    "rewrites": [
    {
    "source": "/api/(.*)",
    "destination": "/api"
    },
    {
    "source": "/test",
    "destination": "/api/ping"
    },
    {
    "source": "/oauth/(.*)",
    "destination": "/api/oauth/$1"
    },
    {
    "source": "/register",
    "destination": "/api/oauth/register"
    },
    {
    "source": "/.well-known/oauth-authorization-server",
    "destination": "/api/.well-known/oauth-authorization-server"
    },
    {
    "source": "/.well-known/oauth-authorization-server/(.*)",
    "destination": "/api/.well-known/oauth-authorization-server/$1"
    },
    {
    "source": "/.well-known/oauth-protected-resource",
    "destination": "/api/.well-known/oauth-protected-resource"
    }
    ]
    }