W
Wasp3mo ago
jit

Does wasp support subdomains like app.websitename.com?

If, so how can I implement it. I am using the opensaas template.
3 Replies
kapa.ai
kapa.ai3mo ago
Hi @jit. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave: ---------------------- Wasp does support deploying your app to a custom domain, which can include subdomains like app.websitename.com. The process involves configuring your deployment and environment variables appropriately. For example, when deploying to Fly.io, you can set up a custom domain (including subdomains) by: 1. Adding your subdomain to your Fly client app:
wasp deploy fly cmd --context client certs create app.websitename.com

wasp deploy fly cmd --context client certs create app.websitename.com

This command will provide DNS records that you need to add to your domain provider. 2. Setting the WASP_WEB_CLIENT_URL environment variable for your server app to match your subdomain:
wasp deploy fly cmd --context server secrets set WASP_WEB_CLIENT_URL=<https://app.websitename.com>

wasp deploy fly cmd --context server secrets set WASP_WEB_CLIENT_URL=<https://app.websitename.com>

This ensures that CORS and other settings are correctly configured for your subdomain. After these steps, your Wasp app (including the OpenSaaS template) should be available at your chosen subdomain, such as https://app.websitename.com. Make sure to follow the DNS instructions provided by the deployment command to complete the setup. For more details, see the official documentation on using a custom domain for your app. If you are serving your client from a subdirectory (e.g., https://example.com/my-app), you should also set the baseDir option in your Wasp config and ensure WASP_WEB_CLIENT_URL matches the full path, but for subdomains, the process above is sufficient Base Directory. If you are using a different hosting provider, the process will be similar: configure your DNS to point the subdomain to your app and set the appropriate environment variables for your server. ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ---------------------- Sorry @jit, I seem to be having a bit of trouble. Don't worry though, I've pinged my support and they will try to fix me up! :technologist: Perhaps try again in 15mins?
Filip
Filip2mo ago
Hey, @jit. This isn't really a Wasp thing, it's a DNS thing. Wasp is just in charge of putting your app out there. You configure its domain name separately. But you do need to tell Wasp about this domain, we have instructions for that here: https://wasp.sh/docs/deployment/extras#custom-domain-setup Let me know if you get stuck and I'll be happy to help!
Carlos
Carlos2mo ago
was this useful @jit ?

Did you find this page helpful?