Skip to content

Conversation

mintlify[bot]
Copy link
Contributor

@mintlify mintlify bot commented Feb 1, 2025

Instruction

here's a script for setting up at a subdirectory when you want to host in a subdomain. add this to our docs.

function handleRequest(request) {
  const url = new URL(request.url);

  if (url.pathname.toLocaleLowerCase().startsWith('/docs') && !url.pathname.toLocaleLowerCase().startsWith('/docs.json')) {
    url.hostname = 'mintlify.mintlify.dev';
    return fetch(url.toString(), request);
  } else {
    url.hostname = 'landing.mintlify.com';
    return fetch(url.toString(), request);
  }
}

addEventListener('fetch', event => {
  event.respondWith(handleRequest(event.request));
});

Summary

Added documentation for setting up Mintlify docs in a subdirectory using Vercel, including a request handler script for proper subdomain routing.

Changes

  • Created advanced/subpath/vercel.mdx

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant