I am running document server in a network of docker containers. I have configured Traefik as reverse proxy and set up routing to different services. I am calling document builder api from a backend server running in another container. The problem I am currently facing is that I get response with error -3. The file opening does not seem to work. Here is the payload.
var sDocURL = Argument["doc_url"];
var sDocName = Argument["filename"];
var sFormsData = Argument["data"]
builder.OpenFile("jsValue(sDocURL)");
var oDocument = Api.GetDocument();
oDocument.SetFormsData(Argument["data"]);
builder.SaveFile("pdf", "jsValue(sDocName)");
builder.CloseFile();
If I use docker internal network and send the following as payload, it succeeds. The difference is that I am using http://backend:8000/api/docs/ttYYvyy66yYYgggDD/download/ as value for doc_url argument
Although it succeeds, no token is attached to headers when the file download request is made by onlyoffice server. The onlyoffice server url I am using is https://proxy/docbuilder. I am using version 8.2
The onlyoffice server logs in the container contains Api not defined error when I use https. The error in the backend server logs does not log any error besides -3.
Also, other problem is that when I use http protocol and docker network internal communication, I do not receive token in the request headers. I am using https protocol and reverse proxy url for loading editor in the frontend as well, which works fine and the download request from the editor does attach token to request headers.
Thanks for your reply. I would like to confirm from you that if every request that originates from onlyoffice document server when opening a file from a builder script does contain token attached to the request headers.
I’m not following your question - what kind of token you are talking about? As far as I know, Document Server simply utilized GET request to download the file via provided link.
I mean when I use the configuration for the loading onlyoffice editor in the frontend, the editor sends a request to the url specified in the cofiguration for uploading the document. This request contain authentication token in headers which I am using first to authenticate the request and send the document as response.
But, when I am using docbuilder api to open the document and fill form data, the request to fetch the document does not have token attached to headers and need to bypass the authentication. I want that the GET request from the document server to have jwt token attached to headers so that I can authenticate it in this case too.
According to this documentation Token in header , every outgoing request from documentserver should contain jwt token in header. But, I am not getting token attached to the GET request headers when using document builder api with above script while opening the file.
I also tried with converter api Conversion API and I do get jwt token in headers for outgoing GET request from documentserver to fetch the file for conversion.
I don’t get token in headers only when using document builder api and the script which opens a file
I am using developer edition 8.2 onlyoffice/documentserver-de:8.2 image . I tried with hardcoding values in the script. Still, the token is not persisting.
Our company is testing onlyoffice as a tool to create document automation. We are generating templates from documents in onlyoffice editor and we want to create documents dynamically in our backend. This is very much a required feature. We also need that every request coming from documentserver to our backend to have token attached to its headers.