Subdomain/Region
Connecting to your local environment
When you start the CLI the services are exposed similarly to the way they are exposed in the cloud. For instance, the following information is shown on your terminal after running nhost up
There you can see the various URLs you can use to access each service plus the region and subdomain you can use to configure the SDK:
The domains in the URLs above will all return the IP address for localhost, 127.0.0.1
, which should suffice for most development environments. For instance:
However, those URLs are powered by a dynamic DNS that can return any IPv4 address you need, you just need to replace the subdomain local
with a subdomain
that contains the 4 octets of the IPv4 address you want separated by -
. For instance:
This is useful if you need to connect to your environment from a different device, a VM or a mobile device emulator.
Some ISPs filter DNS responses that point to localhost and/or private IP space. If your provider is one of them you may have troubles accessing your local dev environment. As a workaround you have two options:
- Follow the instructions under offline access to create static DNS entries in your machine.
- Configure your computer to use a different DNS provider.
To make use of this functionality you can start your development environment after setting the environment variable NHOST_LOCAL_SUBDOMAIN
or passing the flag --local-subdomain
:
Now you can configure the SDK with:
If you are trying to connect to your local environment from an external device or VM make sure that:
- The IP address you are using is reachable from this device/VM
- That your firewall isn’t blocking requests
If you are testing a social provider don’t forget you will need to configure the callback URL to match the subdomain/region you are using. The dashboard should be able to provide this information in settings page.
Offline access
All the URLs in this document are resolved by a public DNS, which means you need Internet access to resolve them. If you need to use any of those URLs without Internet access you can add them to your /etc/hosts
file. For instance:
Just start with the IP you want to resolve followed by all the entries you need separated by spaces.