Open ccll opened 2 years ago
Hmm, can you try with GRIST_SERVE_SAME_ORIGIN=false
?
Closing the loop here, I think I've figured it out. When the server first sends over the GristConfig
to the client for caching, makeGristConfig
calls adaptServerUrl
. This function has the pesky property of overriding the hostname to whatever the hostname of the request if GRIST_SERVE_SAME_ORIGIN
is set.
This environment variable is set by default by the Dockerfile.
If a reverse proxy is set up, you must configure the proxy to pass the Host
header. Otherwise, the request is extracted to be localhost
(if the reverse proxy is on the same host) or whereever the request originates from.
You can verify this by adding just this line in nginx, for example:
location / {
# ...
proxy_set_header Host $host;
}
reloading nginx, and most importantly, clearing your cookies as this is cached as a window element.
Attempting to access the instance will return different results based on whether or not this header is passed in.
This requirement is undocumented as far as I can tell. I was only able to figure this out by chance and by reading the source code.
I'm deploying grist in a k8s cluster.
According to various comments I found in related Github issues, the following env vars were set:
The logs of backend show that the backend is listening on the right k8s internal IP address.![image](https://user-images.githubusercontent.com/5366582/181157426-f177fce6-3532-4166-b749-f85d288ef054.png)
But when the page is loaded in the browser, the frontend is also accessing the API endpoints throught the same k8s internal IP address, instead of![image](https://user-images.githubusercontent.com/5366582/181156795-feb20cb1-de08-4a7e-a599-7c791d554232.png)
https://my.domain.tld
.Full logs:
Am I missing something here?