Q:

Can't load pdf file while using pdftron webviewer server in local

I'm trying to use the webviewer with the webviewer server.  There is security information in the cookie thats needed to be passed on.  In the docker-compose the property to forward is set. 
 webviewer:
    container_name: webviewer-server
    image: pdftron/webviewer-server:latest
    ports:
      - "8090:8090"
    environment:
#      - INCLUDE_DEMO='true'
      - TRN_FORWARD_CLIENT_COOKIES='true'
      - TRN_DEBUG_MODE='true'

Looking at the logs from the webviewer server that information gets to it. 
It recieves the nececery cookie information to make the call to the server.  But when the cal is made the connection is refused. 
Here is the error message. 
| Creating WS connection at endpoint ...
webviewer-server | 09-Apr-2020 14:38:22.554 INFO [http-apr-8090-exec-2] com.pdftron.server. ConnectionService$WebsocketConnection.<init> Creating WS connection 31204549507251, 1 connections total
webviewer-server | 09-Apr-2020 14:38:22.804 INFO [http-apr-8090-exec-10] com.pdftron.server. BlackBoxMessenger.accessLog 31204549507251 accessing http://localhost:8080/secured/fileContent/2?downloadFile=false for page info
webviewer-server | 09-Apr-2020 14:38:22.805 INFO [http-apr-8090-exec-10] com.pdftron.server. ServerJob.<init> Starting pages: /usr/local/apache-tomcat/static_data/Image/Fetched/4XAIzCDauayBoDmSiovlh4f6tcgVwzeZ4NVrpZjKxUA=2.pdf_dir/pageinfo.json
webviewer-server | 09-Apr-2020 14:38:22.806 INFO [http-apr-8090-exec-10] com.pdftron.server. ServerJob.<init> Starting image: /usr/local/apache-tomcat/static_data/Image/Fetched/4XAIzCDauayBoDmSiovlh4f6tcgVwzeZ4NVrpZjKxUA=2.pdf_dir/pageimg0.jpg
webviewer-server | 09-Apr-2020 14:38:22.806 INFO [pool-2-thread-12] com.pdftron.server. DocReference.fetchLocalBlocking needs_fetch: http://localhost:8080/secured/fileContent/2?downloadFile=false
webviewer-server | 09-Apr-2020 14:38:22.807 INFO [pool-2-thread-7] com.pdftron.server. DocReference.fetchLocalBlocking needs_fetch: http://localhost:8080/secured/fileContent/2?downloadFile=false
webviewer-server | 09-Apr-2020 14:38:22.807 INFO [pool-2-thread-12] com.pdftron.server. DocManagement.createFetchThread Adding task http://localhost:8080/secured/fileContent/2?downloadFile=falseto fetch queue
webviewer-server | 09-Apr-2020 14:38:22.810 INFO [pool-5-thread-1] com.pdftron.server. DocManagement$DocFetchTask.doFetch Kicking off potential fetch of http://localhost:8080/secured/fileContent/2?downloadFile=false
webviewer-server | 09-Apr-2020 14:38:22.810 INFO [pool-5-thread-1] com.pdftron.server. DocManagement.constructConnection setting http://localhost:8080/secured/fileContent/2?downloadFile=false custom header Cookie: Idea-b611af61=fc8272b5-372b-48b6-a200-03b7204be819; fingerprint=e68d8c46-0988-4ac0-9154-1aac1be432b0; access_token=eyJhbGciOiJIUzUxMiJ9.eyJzdWIiOiJsY2VyZ2ljK2JAZXJ5Y2UuY29tIiwiY2xpZW50SWQiOiJXRUJfQVBQTElDQVRJT04iLCJ1c2VySWQiOjIsImlzcyI6ImVyeWNlLmNvbSIsImp0aSI6IjkwZDE1ZDBkLTU4ZTctNGM4YS1hMTBlLTdiYjlmZTA1Y2ZhYSIsImlhdCI6MTU4NjQ0Mjg2NSwiZXhwIjoxNTg2NDQzMTY1fQ.zFqrjvEZTwe9QC5azI1HrNG4wbxGrydGdUVli0XmRmf7wv9-KKBFeNsljluz9o7lSXPsAzdrlq5Bhzd3hKk1aw; refresh_token=eyJhbGciOiJIUzUxMiJ9.eyJzdWIiOiJsY2VyZ2ljK2JAZXJ5Y2UuY29tIiwiY2xpZW50SWQiOiJXRUJfQVBQTElDQVRJT04iLCJ1c2VySWQiOjIsImlzcyI6ImVyeWNlLmNvbSIsImp0aSI6IjAyYjc4MjRkLTJjMDAtNDRkNi04ZTY2LWM1OGU0NmM4ODE5YiIsImlhdCI6MTU4NjQ0Mjg2NSwiZXhwIjoxNTg2ODc0ODY1fQ.60jj88_lSH_ZngtfAt6EyzfMzZltCTNxLRYHxfGCUrEKd46O6b9bxCSS23_w4vHvecJebYOtpPgUlD0kYLeiHw; JSESSIONID=CB48A60A9DE9EAFBC94F9C4A98089EB3
webviewer-server | 09-Apr-2020 14:38:22.812 WARNING [pool-2-thread-1] com.pdftron.server.ServerJob.run During job id (/usr/local/apache-tomcat/static_data/Image/Fetched/4XAIzCDauayBoDmSiovlh4f6tcgVwzeZ4NVrpZjKxUA=2.pdf_dir/pageimg0.jpg):
webviewer-server | Exception during job run of type image
webviewer-server |  java.lang. Exception: WebViewer Server complete job (/usr/local/apache-tomcat/static_data/Image/Fetched/4XAIzCDauayBoDmSiovlh4f6tcgVwzeZ4NVrpZjKxUA=2.pdf_dir/pageimg0.jpg) failed: unable to complete fetch of http://localhost:8080/secured/fileContent/2?downloadFile=false
webviewer-server | Connection refused (Connection refused)
webviewer-server |      at com.pdftron.server. ServerJob.run(Unknown Source)
webviewer-server |      at java.util.concurrent. ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
webviewer-server |      at java.util.concurrent. ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
webviewer-server |      at java.lang. Thread.run(Thread.java:748)
webviewer-server | 09-Apr-2020 14:38:22.812 WARNING [pool-2-thread-4] com.pdftron.server.ServerJob.run During job id (/usr/local/apache-tomcat/static_data/Image/Fetched/4XAIzCDauayBoDmSiovlh4f6tcgVwzeZ4NVrpZjKxUA=2.pdf_dir/pageinfo.json):
webviewer-server | Exception during job run of type pages
webviewer-server |  java.lang. Exception: WebViewer Server complete job (/usr/local/apache-tomcat/static_data/Image/Fetched/4XAIzCDauayBoDmSiovlh4f6tcgVwzeZ4NVrpZjKxUA=2.pdf_dir/pageinfo.json) failed: unable to complete fetch of http://localhost:8080/secured/fileContent/2?downloadFile=false
webviewer-server | Connection refused (Connection refused)
webviewer-server |      at com.pdftron.server. ServerJob.run(Unknown Source)
webviewer-server |      at java.util.concurrent. ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
webviewer-server |      at java.util.concurrent. ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
webviewer-server |      at java.lang. Thread.run(Thread.java:748)
webviewer-server | Closing ws connection from endpoint: CloseReason: code [1001], reason [null]
webviewer-server | 09-Apr-2020 14:39:06.386 INFO [http-apr-8090-exec-4] com.pdftron.server. ConnectionService$Connection.onCloseImpl Closing Connection, 0 outstanding

Now the "? downloadFile=false" part is a bit misleading but it does not actually stop the file fetching. 
All of the services are running on my localhost.  Its just that the webviewer container is running in a docker container of course. Which was started with a docker-compose up command.  And It seems it cannot make the call from the container to the localhost service. 
The log does not show up in the service, Webviewer just says that the connection was refused. 
On first attempt i tried fetching the files with an arraybuffer from the same url, and that worked.  Of course in that case the front end which is also running on the localhost right now could fetch the file and i could show the file on the front end. 
But as soon as I added the server the server could not access the service. 
Also this is how I configured the file reading on the front end angular app
const configWebViewer = {
  pdftronServer: serverUrlWithoutPort + ':8090/',
  path: '../../../../../../../../../../assets/webviewer',
  withCredentials: true,
  initialDoc: fileUrl,
}
WebViewer(configWebViewer, this.viewer.nativeElement)

Now another thing is that for some reason in the console I get a warning that "withCredentials" is not a know property. 
I've been looking at this all day and I'm not sure what to do any more even though I'm still trying.  So if there is any information I could get, maybe an oversight from my part or something that would be greatly appreciated. 
Kind Regards

A:

For anyone that might come across here in the same or similar situation as I was. 
The problem was of course the 'localhost'. 
All of my services were running in the same docker compose.  So they were on the same network which I think docker-compose creates for them. 
I changed out the 'localhost' in the url for the name of the container for example to 'myService' how its defined in the docker-compose file. 
Because of that the webviewer server was able to retrieve the file from the service through the url I gave it.  
This problem should not arise in deployment/production and such.  Because in that case you aren't running everything in localhost and such.  
This was just problematic in the local because I was trying to test PdfTron.  
Also another problem I didn't solve yet really is that because I started the service in a docker container I can't debug that service.  
And of course there will be cases where I'll need to view the file in PdfTron and debug that service.  
But maybe the way docker-compose creates the network maybe that is something I could try.  
Either way I hope this helps anyone who comes across this. 