Vercel

Host Jamdesk docs at a /docs subpath using Vercel rewrites

Use Vercel rewrites to proxy documentation requests to Jamdesk. Rewrites happen at the edge and don't change the URL in the browser.

Prerequisites

  • A project deployed on Vercel
  • Your Jamdesk subdomain (found in dashboard settings)

Step 1: Update vercel.json

Add a rewrites configuration to your vercel.json file. If the file doesn't exist, create it in your project root:

title="vercel.json"
{
  "rewrites": [
    {
      "source": "/docs",
      "destination": "https://YOUR_SLUG.jamdesk.app/docs"
    },
    {
      "source": "/docs/:path*",
      "destination": "https://YOUR_SLUG.jamdesk.app/docs/:path*"
    }
  ]
}

Replace YOUR_SLUG with your actual Jamdesk subdomain (e.g., acme if your docs are at acme.jamdesk.app).

Step 2: Deploy

Deploy your changes to Vercel:

vercel --prod

Or push to your connected Git repository to trigger an automatic deployment.

Step 3: Verify

Visit https://yoursite.com/docs to confirm your documentation is being served correctly.

Understanding the Configuration

PropertyDescription
sourceThe path pattern on your domain that triggers the rewrite
destinationThe URL to proxy the request to
:path*A wildcard that captures all path segments after /docs/

The two rewrite rules handle:

  1. The base /docs path (e.g., yoursite.com/docs)
  2. All nested paths (e.g., yoursite.com/docs/getting-started)

Adding to Existing Rewrites

If you already have rewrites configured, add the Jamdesk rules to your existing array:

title="vercel.json"
{
  "rewrites": [
    { "source": "/api/:path*", "destination": "/api/:path*" },
    { "source": "/docs", "destination": "https://YOUR_SLUG.jamdesk.app/docs" },
    { "source": "/docs/:path*", "destination": "https://YOUR_SLUG.jamdesk.app/docs/:path*" }
  ]
}

Rewrite order matters. Place more specific rules before general ones.

Using next.config.js (Next.js Projects)

For Next.js projects, you can alternatively configure rewrites in next.config.js:

title="next.config.js"
/** @type {import('next').NextConfig} */
const nextConfig = {
  async rewrites() {
    return [
      {
        source: "/docs",
        destination: "https://YOUR_SLUG.jamdesk.app/docs",
      },
      {
        source: "/docs/:path*",
        destination: "https://YOUR_SLUG.jamdesk.app/docs/:path*",
      },
    ];
  },
};

export default nextConfig;

Troubleshooting

Ensure vercel.json is in your project root and properly formatted. Check the Vercel deployment logs for configuration errors.

Verify you have both rewrite rules - one for /docs and one for /docs/:path*. Missing the wildcard rule causes nested pages to fail.

Check that your destination URL uses https:// and points to jamdesk.app, not your own domain.

What's Next?

Reverse Proxy

Alternative: nginx, Apache, Caddy

All Options

Back to overview