Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

integrate subdomain forwarding in project #6

Open
kjloveless opened this issue Oct 9, 2024 · 2 comments
Open

integrate subdomain forwarding in project #6

kjloveless opened this issue Oct 9, 2024 · 2 comments

Comments

@kjloveless
Copy link
Owner

i think i want to add a middleware to inspect the hostname and if a subdomain is present then just respond with the result at /[handle]/.well-known/atproto-did

this wasn't immediately clear to me when looking at nextjs docs and fresh docs.

however the domain attachment is handled by Deploy, so as long as the app logic is checking for subdomains, i think this should work??

@kjloveless
Copy link
Owner Author

right now i have a deploy playground instance with the wildcard subdomain attached executing this code:

Deno.serve(async (req: Request) => {
  const url = new URL(req.url);
  const domainParts = url.hostname.split(".");
  console.log(domainParts);
  try {
    const resp = await fetch(
      `https://${domainParts[1]}.${domainParts[2]}/${domainParts[0]}/.well-known/atproto-did`,
    );
    console.log(resp);
    return resp;
  } catch (e) {
    console.log(e);
    return new Response("Not Found!");
  }
});

@kjloveless
Copy link
Owner Author

this has the benefit that you can use one project as your "subdomain forwarder" but it is kind of annoying to have to maintain certificates across projects...

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

No branches or pull requests

1 participant