Trouble Previewing Forms in ODK Central on Ubuntu Server 22.04: 'Could Not Connect with Form Server' Error

1. What is the issue? Please be detailed.
I successfully installed a self-hosted ODK Central on an Ubuntu Server 22.04 within my local network, and everything seems to be working fine overall. However, I'm encountering an issue where I cannot preview forms in either the web browser or ODK Collect. Whenever I try to preview a form in the web browser, it returns the error message "Could not connect with Form Server."

2. What steps can we take to reproduce this issue?

3. What have you tried to fix the issue?

4. Upload any forms or screenshots you can share publicly below.

//.env

# Use fully qualified domain names. Set to DOMAIN=local if SSL_TYPE=selfsign.
#DOMAIN=your.domain.com
DOMAIN=localhost

# Used for Let's Encrypt expiration emails and Enketo technical support emails
SYSADMIN_EMAIL=administrator@email.com

# Options: letsencrypt, customssl, upstream, selfsign
#SSL_TYPE=letsencrypt
SSL_TYPE=selfsign

# Do not change if using SSL_TYPE=letsencrypt
HTTP_PORT=80
HTTPS_PORT=443

# Optional: configure Node
# SERVICE_NODE_OPTIONS=

# Optional: connect to a custom database server
# DB_HOST=
# DB_USER=
# DB_PASSWORD=
# DB_NAME=

# Optional: configure a custom mail server
# EMAIL_FROM=
# EMAIL_HOST=
# EMAIL_PORT=
# EMAIL_SECURE=
# EMAIL_IGNORE_TLS=
# EMAIL_USER=
# EMAIL_PASSWORD=

# Optional: configure Single Sign-on with OpenID Connect
# OIDC_ENABLED=
# OIDC_ISSUER_URL=
# OIDC_CLIENT_ID=
# OIDC_CLIENT_SECRET=

# Optional: configure error reporting
# SENTRY_ORG_SUBDOMAIN=
# SENTRY_KEY=
# SENTRY_PROJECT=

# Optional: configure S3-compatible storage for binary files
# S3_SERVER=
# S3_ACCESS_KEY=
# S3_SECRET_KEY=
# S3_BUCKET_NAME=

Welcome to the forum @kibrom.mahari! When you have a chance, we encourage you to introduce yourself and your project to help build community and add context around your needs. Adding a profile image also helps build community. It also looks like you may have created a second account - @Kibrom_Mahari ?

I see you have set DOMAIN to localhost, please see this post:

Greetings! I apologize for not introducing myself earlier—my name is Kibrom Mahari, and I am currently working on a project aimed at collecting information about farmers in Ethiopia. As I mentioned previously, I have successfully installed ODK Central on my local machine and set the domain to localhost. While I have been able to create various projects and upload forms to my Central instance, I am encountering an issue where I am unable to preview the forms I have uploaded for my projects. I would greatly appreciate any guidance or troubleshooting steps to resolve this issue and ensure that I can preview and test my forms effectively. Thank you in advance for your assistance!

As noted at https://docs.getodk.org/central-install/#self-hosting, to self-host Central and have everything work properly, you must have a fully qualified domain name (e.g., central.example.com) mapped to your server. For security reasons, Central will not work with localhost or just an IP address (e.g., 93.184.216.34).