Hi,
I am self-hosting Grist on a local server with the Docker image and reverse proxy setup using Apache. Authentik is used for multi-user support.
Grist is run with the following command:
sudo docker run \
-p 9999:9999 \
--env-file ~/grist/.env \
--env DEBUG=1 \
-v ~/grist/persist:/persist \
-it gristlabs/grist
The following is my environment variables file:
PORT=9999
DEBUG=1
APP_HOME_URL=https://gr.internal
GRIST_ORG_IN_PATH=true
GRIST_SAML_SP_HOST=https://gr.internal
GRIST_SAML_SP_KEY=/persist/sp.key
GRIST_SAML_SP_CERT=/persist/sp.pem
GRIST_SAML_IDP_LOGIN=https://auth.internal/application/saml/grist/sso/binding/redirect/
GRIST_SAML_IDP_LOGOUT=https://auth.internal/if/session-end/grist/
GRIST_SAML_IDP_CERTS=/persist/sp.pem
GRIST_SAML_IDP_UNENCRYPTED=1
GRIST_HIDE_UI_ELEMENTS=helpCenter,billing
NODE_EXTRA_CA_CERTS=/persist/ca.crt
Apache configured as follows:
<VirtualHost gr.internal:443>
ProxyPreserveHost On
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
SSLEngine On
SSLProxyEngine On
SSLProxyVerify none
SSLProxyCheckPeerName Off
ProxyRequests Off
ProxyPass / http://gr.internal:9999/
ProxyPassReverse / http://gr.internal:9999/
RewriteEngine on
RewriteCond %{HTTP:Upgrade} websocket [NC]
RewriteCond %{HTTP:Connection} upgrade [NC]
RewriteRule ^/?(.*) "ws://gr.internal:9999/$1" [P,L]
RequestHeader set X-Forwarded-Proto "https"
RequestHeader set X-Forwarded-Port "443"
SSLCACertificateFile "/home/USER/grist/persist/ca.crt"
SSLCertificateFile "/home/USER/grist/persist/sp.pem"
SSLCertificateKeyFile "/home/USER/grist/persist/sp.key"
ServerName gr.internal
</VirtualHost>
The functions that I have tried so far seems to work fine so far except for duplicating documents.
When I try to duplicate document and click Save, I keep getting the âFile canât be found at the requested URL.â message.
The log in the console:
2024-01-11 10:21:18.660 - warn: client error stack=Error: Request to https://gr.internal/o/docs/api/docs failed with status 404: Not Found (File can't be found at the requested URL.)
at y (https://gr.internal/v/unknown/main.bundle.js:2:497670)
at D.request (https://gr.internal/v/unknown/main.bundle.js:2:497390)
at async b.countPendingRequest (https://gr.internal/v/unknown/main.bundle.js:2:496091)
at async D.requestJson (https://gr.internal/v/unknown/main.bundle.js:2:497441)
at async b.countPendingRequest (https://gr.internal/v/unknown/main.bundle.js:2:496091)
at async x.save (https://gr.internal/v/unknown/main.bundle.js:2:276499)
at async https://gr.internal/v/unknown/main.bundle.js:2:484046, message=Request to https://gr.internal/o/docs/api/docs failed with status 404: Not Found (File can't be found at the requested URL.), status=404, userError=File can't be found at the requested URL., docId=6ETKnnsGa37n1UQdxJadd4, page=https://gr.internal/o/docs/6ETKnnsGa37n/Expenses/p/4, language=en-US, platform=Win32, userAgent=Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36, org=docs, email=USER@DOMAIN.COM, userId=5, altSessionId=3BgGLoD8UMAGCX5uZgjS1P
The request header:
POST /o/docs/api/docs HTTP/1.1
Accept: */*
Accept-Encoding: gzip, deflate, br
Accept-Language: en-US,en;q=0.9,en-AU;q=0.8,id;q=0.7
Cache-Control: no-cache
Connection: keep-alive
Content-Length: 113
Content-Type: application/json
Cookie: grist_core=s%3Ag-r6XmUZc2yvBcAyqoFbFsoW.3H%2B%2BGRwxVfViH5gQqnIL5wvR3gM5i%2B1fuUioGcsqbdw; grist_core_status=S
DNT: 1
Host: gr.internal
Origin: https://gr.internal
Pragma: no-cache
Referer: https://gr.internal/o/docs/6ETKnnsGa37n/Expenses/p/4
Sec-Fetch-Dest: empty
Sec-Fetch-Mode: cors
Sec-Fetch-Site: same-origin
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36
X-Requested-With: XMLHttpRequest
sec-ch-ua: "Not_A Brand";v="8", "Chromium";v="120", "Google Chrome";v="120"
sec-ch-ua-mobile: ?0
sec-ch-ua-platform: "Windows"
Request payload:
{"sourceDocumentId":"6ETKnnsGa37n1UQdxJadd4","workspaceId":2,"documentName":"Expenses (copy)","asTemplate":false}
Response header:
HTTP/1.1 404 Not Found
Date: Thu, 11 Jan 2024 10:21:18 GMT
Server: Apache/2.4.52 (Ubuntu)
X-Powered-By: Express
Content-Language: en-US
Access-Control-Allow-Methods: GET, PATCH, PUT, POST, DELETE, OPTIONS
Access-Control-Allow-Origin: https://gr.internal
Vary: Origin
Access-Control-Allow-Credentials: true
Access-Control-Allow-Headers: Authorization, Content-Type, X-Requested-With
Cache-Control: no-cache
Content-Type: application/json; charset=utf-8
Content-Length: 53
ETag: W/"35-9eL+0vghkXp2kP64+wuXtLOTxh8"
Keep-Alive: timeout=5, max=98
Connection: Keep-Alive
Response:
{"error":"File can't be found at the requested URL."}
Based on the above, I tried using curl as follows, but the response is still the same:
curl -v \
-H "Authorization: Bearer <API_KEY>" \
-H "Content-Type: application/json" \
-d '{"sourceDocumentId":"6ETKnnsGa37n1UQdxJadd4","workspaceId":2,"documentName":"Expenses (copy)","asTemplate":false}' \
https://gr.internal/o/docs/api/docs
I tried checking the API documentation but could not find anything on the endpoint /docs with method POST.
I have updated to the latest Docker image 1.1.10, but still unable to duplicate document. Installed on VM and physical server with the same result. Tried with different configurations of the environment variables to the best of my understanding but to no avail, perhaps I am not looking in the right places. Please help.
Thanks.