Experiencing CORS Issues - Seeking Assistance

Hello everyone,

I’ve recently encountered some CORS-related issues while trying to set up my Grist instance, and I’m hoping to get some help from the community to resolve this.

Here’s my setup:

  • I’m using the gristlabs/grist Docker image.
  • I’ve started my Grist container with the following environment variables:
    sudo docker run --env GRIST_DOMAIN=(mine)
    –env GRIST_DEFAULT_EMAIL=(mine-rayse@gristcom)
    –env GRIST_SERVE_SAME_ORIGIN=true
    –env GRIST_FORWARD_AUTH_HEADER=x-forwarded-user
    –env GRIST_FORCE_LOGIN=true
    –env PORT=8084
    –env GRIST_BOOT_KEY=secret
    –env GRIST_SESSION_COOKIE=GristSession
    –env GRIST_SESSION_DOMAIN=.raysecloud.com
    –env GRIST_SESSION_SECRET=SimplePass123!
    –name grist1
    -p 8084:8084 -v $PWD/persist:/persist -it gristlabs/grist
    My Apache server is configured as follows:
    <VirtualHost :80>
    ServerName (mine-grist.raysecloudcom)
    RewriteEngine on
    RewriteCond %{REQUEST_URI} !^/.well-known/acme-challenge
    RewriteRule (.
    ) https://%{SERVER_NAME}$1 [R]

    <VirtualHost :443>
    ServerName (mine-grist.raysecloudcom)
    SSLEngine on
    SSLCertificateFile “/etc/apache2/sites-enabled/certs/grist.raysecloud.com.pem”
    ProxyPass / (mine,example-http:/192.168.0.197:8084)/
    ProxyPassReverse / (mine,example-http:/192.168.0.197:8084)/
    Header set Access-Control-Allow-Origin "
    "
    Header set Access-Control-Allow-Methods “GET, POST, OPTIONS”
    Header set Access-Control-Allow-Headers “X-Requested-With”

    I’m encountering CORS errors in the browser, and the console shows “Failed to fetch” errors. I’ve checked the Apache proxy settings and CORS headers, but the issue persists.

Has anyone else come across a similar issues, or have any advice on how I might resolve this?

Thanks in advance!

Hi @weichao.jiao, do the checks on the /admin page identify any specific problem? You may need to set APP_HOME_URL.

Thank you, I’ve managed to access Grist via the domain name by configuring APP_HOME_URL. It turns out I didn’t know enough about Grist. Thank you very much!