UPDATE: Now with our simplified SDK embedding that doesn't require CNAMEs, dev mode became unnecessary. Everything works the same way on your prod/staging and local instances and no extra steps to set up SDK locally are needed. Hurray!
We suggest creating a separate test community for development and testing, so you don't have to configure another domain and deal with CNAME proxying. When you finish with the local setup, you can replicate the same process but set the real domain for your production environment. You can create and configure a community with a free plan for development here.
For local testing, you need to emulate CNAME redirects locally. You should use the same domain as you specified in community integration settings in your hosts file and use it during your app testing to be as close as possible to the production environment.
💡 Note: Just localhost
won't work.
In your hosts
file:
- Point this fake domain to your local frontend app address
- Point its subdomain
peerboard
(e.g. peerboard.myapp.local
) to our server IP address
You may find the IP address of our server using the command $ host peerboard.org
# Port is insignificant - eg can be hosted on myapp.local:3000
127.0.0.1 myapp.local
# This is similar to a DNS CNAME record to proxy our API.
3.208.198.73 peerboard.myapp.local
Don't forget to enable the "Integration SDK" with "Local development mode" checkbox under Settings -> Hosting with the desired domain.
After setting that up, you need to disable the https certificate check for our forum iframe. That's due to our CNAME proxying, and you will not have this warning in production.
To do that, open peerboard.myapp.local
(the URL we serve API from) in your browser, and you will see an https security risk warning. Click "Proceed to https://peerboard.myapp.local/ (unsafe)" in Chrome or "Accept the risk and continue" in Firefox, so that the browser remembers your choice and will to load our iframe.