Change server url
Hi how could i change the server url to which the client makes requests now? I setup a custom domain and want the client to use my custom server domain instead of the .fly.dev
4 Replies
Hi @Sven. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:
----------------------
To change the server URL that the client uses to make requests after setting up a custom domain, you need to update the
REACT_APP_API_URL
environment variable when building your client. Here's how you can do it:
1. When building your client for production, set the REACT_APP_API_URL
to your new custom domain. For example:
2. After deploying your client, make sure to update the WASP_WEB_CLIENT_URL
environment variable on your server to reflect your new client URL. You can do this using the Fly.io CLI:
3. If you haven't already, you should also update the WASP_SERVER_URL
on your server to reflect your new custom domain:
These steps will ensure that your client makes requests to your custom domain instead of the default .fly.dev domain.
Deploying the Client (https://wasp-lang.dev/docs/advanced/deployment/manually#deploying-the-client) provides more detailed information on building and deploying the client, including setting the REACT_APP_API_URL
.
Using a Custom Domain For Your App (https://wasp-lang.dev/docs/advanced/deployment/cli#using-a-custom-domain-for-your-app) offers additional guidance on setting up custom domains with Fly.io.
Remember to update your DNS records and configure your custom domain in Fly.io as described in the documentation to ensure everything works correctly with your new domain.
----------------------
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:
----------------------
Sorry @Sven, 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?@kapa.ai I am using fly, please explain again
Let me check the knowledge base for you again. One moment! :books:
----------------------
Certainly! I apologize for any confusion. Since you're using Fly.io, let me explain the process specifically for that platform.
When you set up a custom domain for your Wasp app on Fly.io, you need to update a few things to ensure the client makes requests to your custom server domain instead of the default .fly.dev domain. Here's the process:
1. First, set up your custom domain on Fly.io using the Wasp CLI:
Replace
your-custom-domain.com
with your actual domain name.
2. Add the DNS records as instructed by the output of the above command.
3. Update the WASP_WEB_CLIENT_URL
environment variable on your server to use your custom domain:
This step is crucial for keeping your CORS configuration up to date Using a Custom Domain For Your App (https://wasp-lang.dev/docs/advanced/deployment/cli#using-a-custom-domain-for-your-app).
4. You should also update the WASP_SERVER_URL
to reflect your new custom domain:
5. For the client-side, when you're building your web app for deployment, you need to set the REACT_APP_API_URL
to your new custom domain:
This ensures that the client makes requests to your custom domain instead of the .fly.dev domain Client configuration object (https://wasp-lang.dev/docs/advanced/accessing-app-config#client-configuration-object).
After completing these steps and redeploying your app, your client should now make requests to your custom domain instead of the .fly.dev domain. Remember to replace your-custom-domain.com
with your actual custom domain in all the commands above.
----------------------
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:
----------------------
Sorry @Sven, 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?Tried to get help from kapa but for main issue please read from:
https://discord.com/channels/686873244791210014/1311627403478700063/1312710512416522241