if I don't use "www." then my app doesn't show

Hey folks (@kapa.ai in particular lol), if I use "www." to go to my app. then my app doesn't show up and I get the squarespace under construction page, but if I leave www. out then my app runs just fine. Any ideas what I could do to fix this?
9 Replies
kapa.ai
kapa.ai4mo ago
Hi @haarismian. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave: ---------------------- It seems like you're having an issue with your custom domain configuration. Here are some steps you can follow to troubleshoot: 1. Check your DNS records: Make sure that both your www and non-www versions of your domain are correctly set up in your DNS records. You should have an A record for @ and an AAAA record for @ with the values provided by the wasp deploy fly cmd --context client certs create mycoolapp.com command. source (https://wasp-lang.dev/docs/advanced/deployment/cli#using-a-custom-domain-for-your-app) 2. Check your WASP_WEB_CLIENT_URL environment variable: Make sure that the WASP_WEB_CLIENT_URL environment variable for your server app is set to your domain (with or without www, depending on your preference). You can set this variable with the wasp deploy fly cmd --context server secrets set WASP_WEB_CLIENT_URL=<https://mycoolapp.com> command. source (https://wasp-lang.dev/docs/advanced/deployment/cli#using-a-custom-domain-for-your-app) 3. Check your app's baseDir configuration: If you're serving your app from a subdirectory, make sure that the baseDir option in your app's configuration and the WASP_WEB_CLIENT_URL environment variable both include that base directory. source (https://wasp-lang.dev/docs/project/client-config#base-directory) If you've checked all of these and you're still having issues, it might be a good idea to reach out to your domain provider or the Wasp community for further assistance. ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ---------------------- Sorry @haarismian, 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?
haarismian
haarismianOP4mo ago
@kapa.ai I would like both to work
kapa.ai
kapa.ai4mo ago
Let me check the knowledge base for you. One moment! :books: ---------------------- To make both www.yourdomain.com and yourdomain.com work, you need to set up DNS records for both in your DNS provider. Here are the general steps: 1. Set up DNS records for both versions of your domain: You should have an A record for @ (which represents the non-www version of your domain) and a CNAME record for www pointing to your domain. The exact steps to do this can vary depending on your DNS provider. 2. Check your WASP_WEB_CLIENT_URL environment variable: Make sure that the WASP_WEB_CLIENT_URL environment variable for your server app is set to your preferred version of your domain (with or without www). You can set this variable with the wasp deploy fly cmd --context server secrets set WASP_WEB_CLIENT_URL=<https://yourdomain.com> command. source (https://wasp-lang.dev/docs/advanced/deployment/cli#using-a-custom-domain-for-your-app) 3. Check your app's baseDir configuration: If you're serving your app from a subdirectory, make sure that the baseDir option in your app's configuration and the WASP_WEB_CLIENT_URL environment variable both include that base directory. source (https://wasp-lang.dev/docs/project/client-config#base-directory) Please note that DNS changes can take up to 48 hours to propagate worldwide, although it usually happens much faster. If you're still having issues after following these steps, it might be a good idea to reach out to your domain provider or the Wasp community for further assistance. ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ---------------------- Sorry @haarismian, 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?
haarismian
haarismianOP4mo ago
@kapa.ai when setting up the WASP_WEB_CLIENT_URL can it be both?
kapa.ai
kapa.ai4mo ago
Let me check the knowledge base for you. One moment! :books: ---------------------- The WASP_WEB_CLIENT_URL environment variable should be set to the URL where your client (frontend) will be accessible. This URL is used for configuring CORS and other settings. However, it can only be set to one value at a time. If you want your application to be accessible both with and without www, you should configure your DNS and server to redirect one to the other. For example, if you set WASP_WEB_CLIENT_URL to <https://www.yourdomain.com,> you should configure your server or DNS provider to redirect all traffic from <https://yourdomain.com> to <https://www.yourdomain.com> (or vice versa if you prefer the non-www version). This way, even though WASP_WEB_CLIENT_URL is set to one version of the domain, users will be able to access your app using both versions of the domain. source (https://wasp-lang.dev/docs/advanced/deployment/cli#using-a-custom-domain-for-your-app) ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ---------------------- Sorry @haarismian, 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?
haarismian
haarismianOP4mo ago
ok please give me the instructions for sqaurespace dns settings to set up dns records for both, these are my current dns settings @kapa.ai Custom records Add record Host Type Priority Data @ A N/A 66.241.125.42 @ AAAA N/A 2a09:8280:1:0:0:3a:2ab8:0 @ TXT N/A google-site-verification=41-vp_Zjf1dYdk8SgQgGLaXZSQc1_SHhW71Ty-iDVUM 44853346 CNAME N/A sendgrid.net _acme-challenge CNAME N/A yellowbirdapp.com.dyy98g.flydns.net _dmarc TXT N/A v=DMARC1; p=none; s1._domainkey CNAME N/A s1.domainkey.u44853346.wl097.sendgrid.net s2._domainkey CNAME N/A s2.domainkey.u44853346.wl097.sendgrid.net em5273 CNAME N/A u44853346.wl097.sendgrid.net url1332 CNAME N/A sendgrid.net
kapa.ai
kapa.ai4mo ago
Let me check the knowledge base for you. One moment! :books: ---------------------- To make both www.yourdomain.com and yourdomain.com work, you need to add a CNAME record for www in your Squarespace DNS settings. Here's how you can do it: 1. In your Squarespace DNS settings, click on "Add record". 2. For the "Host" field, enter www. 3. For the "Type" field, select CNAME. 4. For the "Data" field, enter yourdomain.com. 5. Click on "Add" to save the record. Your DNS settings should look something like this:
Host Type Data
@ A 66.241.125.42
@ AAAA 2a09:8280:1:0:0:3a:2ab8:0
www CNAME yourdomain.com
... ... ...
Host Type Data
@ A 66.241.125.42
@ AAAA 2a09:8280:1:0:0:3a:2ab8:0
www CNAME yourdomain.com
... ... ...
Please replace yourdomain.com with your actual domain name. Remember, DNS changes can take up to 48 hours to propagate worldwide, although it usually happens much faster. If you're still having issues after following these steps, it might be a good idea to reach out to Squarespace support or the Wasp community for further assistance. Please note that the instructions provided are based on general DNS setup practices and not directly from the provided knowledge sources. For more specific instructions, please refer to Squarespace's official documentation or support. ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ---------------------- Sorry @haarismian, 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?
miho
miho4mo ago
Here's a way to use multiple domains for CORS by using custom global middleware
app corsTest {
wasp: {
version: "^0.14.0"
},
title: "cors-test",
server: {
middlewareConfigFn: import { getGlobalMiddleware } from "@src/data",
}
}

route RootRoute { path: "/", to: MainPage }
page MainPage {
component: import { MainPage } from "@src/MainPage"
}

query getSomeData {
fn: import { getSomeData } from "@src/data",
entities: []
}
app corsTest {
wasp: {
version: "^0.14.0"
},
title: "cors-test",
server: {
middlewareConfigFn: import { getGlobalMiddleware } from "@src/data",
}
}

route RootRoute { path: "/", to: MainPage }
page MainPage {
component: import { MainPage } from "@src/MainPage"
}

query getSomeData {
fn: import { getSomeData } from "@src/data",
entities: []
}
import cors from "cors";
import { MiddlewareConfigFn } from "wasp/server";
import { GetSomeData } from "wasp/server/operations";

export const getSomeData: GetSomeData = async (_args, _context) => {
return {
someData: "Hello from the server!",
};
};

export const getGlobalMiddleware: MiddlewareConfigFn = (config) => {
const isDevelopment = process.env.NODE_ENV === "development";
const clientUrl = process.env.WASP_WEB_CLIENT_URL ?? "http://localhost:3000";

// Allow all origins in development, otherwise only allow the client URL.
const origin = isDevelopment ? "*" : [clientUrl, 'http://someotherurl.com'];

config.delete("cors");
config.set(
"cors",
cors({
origin,
})
);

return config;
};
import cors from "cors";
import { MiddlewareConfigFn } from "wasp/server";
import { GetSomeData } from "wasp/server/operations";

export const getSomeData: GetSomeData = async (_args, _context) => {
return {
someData: "Hello from the server!",
};
};

export const getGlobalMiddleware: MiddlewareConfigFn = (config) => {
const isDevelopment = process.env.NODE_ENV === "development";
const clientUrl = process.env.WASP_WEB_CLIENT_URL ?? "http://localhost:3000";

// Allow all origins in development, otherwise only allow the client URL.
const origin = isDevelopment ? "*" : [clientUrl, 'http://someotherurl.com'];

config.delete("cors");
config.set(
"cors",
cors({
origin,
})
);

return config;
};
haarismian
haarismianOP4mo ago
thanks @miho
Want results from more Discord servers?
Add your server