I had been working on a tool that’d use orthanc and access it through the rest api. When I initially set this up, I did everything locally and it was all accessed over localhost.
Now I’ve begun moving my project to a staging server. Everything is in docker containers, but that shouldn’t matter since the containers don’t need to talk. I have however noticed that I can no longer make API calls. My calls always return nothing.
To start, I can access my orthanc setup just fine. I can upload and make changes and use it exactly as I expect so far.
The other side of things is a php site that also seems to be working just fine, with the exception of being able to communicate with orthanc. The URLs are correct that I’m using to connect with. I’ve also tried a dummy request in the browser with the orthancurl/instances - no parameters were provided, but I did get a response. It was empty, but it was a response all the same.
I can provide a sample cURL request I’m using, though I heavily suspect the issue is somewhere in my configuration file. I’ve gone through and updated all refferences of localhost:8042 to the new domain. I’ve seen the peers section and tried setting this, but I don’t believe that’s necessary for what I’m doing because that reads as if it was for two instances of orthanc to communicate, which isn’t what I’m attempting.
Does anyone have any ideas what could be causing my rest API calls to not be returned? Like I said, initially they were both on my own machine and both at localhost. Now they’re both on separate URLs that use https, and I suspect either the different sources of the calls or the https to be the culprit, but I have no clue where to look for the settings at this point. I’ve spend the last couple days stuck on this, any help would be massively appreciated!
Hello,
Have you enabled remote access to your Orthanc instance ? Look for RemoteAccessAllowed in the configuration file. If the key is not present in your configuration file, you should add and set it to true (the default being false).
Have a look at : https://hg.orthanc-server.com/orthanc/file/Orthanc-1.8.2/OrthancServer/Resources/Configuration.json
Of course, there could also be some other network issues, but remote access would be the first thing to check.
HTH
Hello,
RemoteAccessAllowed is defined as true in my config document. Still no luck though.
I’m really stumped on this one since, like I said, I was running this previously on my local machine without any problems. I’m going to keep digging but I’m still hopeful someone on here will help point me to the issue.
Have you exposed the 8042 port in your Docker container, by using “-p 8042:8042” option of Docker?
In any case, we don’t have enough information to provide any guidance. Please carefully read the following page about providing a minimal working example:
https://book.orthanc-server.com/users/support.html
I have docker exposed to 8042, but I also set the HttpPost to 80, so would that mean that 8042 is no longer being used? I’m running a firewall on the server and the only ports I have open are 22, 80, and 443. I’m able to access the web gui just fine, everything is running over https. I can upload a copy of my config file in a few. It’s just really been stumping me since everything worked great locally, but once I oved the project to a server, I can’t curl the API. Other than that, I’m able to use the web interface, upload dicom files, seems like a perfectly functional setup, aside from the one single entry point. The curl calls are coming from another domain. In this case, they’re separate docker containers, so even though they’re on the same machine, my understanding is, they for all functional purposes might as well be on servers across the world with some similar configurations.
I appreciate the help so far and I’ll get my config file posted.
Sorry, but you are the only one to know your setup.
You only provide a vague textual description of your goal. You provide no Docker command, no configuration file, no PHP code, no script to setup a working environment, no log…
As far as I’m concerned, I won’t answer your future replies as long as you don’t provide a minimal working example for other people to independently reproduce your setup:
https://book.orthanc-server.com/users/support.html#discussing-a-minimal-working-example
I can appreciate that. I was hoping this would be a simply “Oh that one setting usually does that”, but it doesn’t sound that way now.
I’ll start with the docker-compose entry
orthanc:
image: osimis/orthanc
container_name: orthanc
ports:
- 80:80
- 8042:8042
- 4242:4242
- 443:443
restart: unless-stopped
depends_on:
- postgresql13
networks:
- internal
- traefik
volumes:
- $USERDIR/docker/orthanc/orthanc.json:/etc/orthanc/orthanc.json:ro
- /tmp/orthanc-db:/var/lib/orthanc/db/
environment:
VERBOSE_ENABLED: “true”
VERBOSE_STARTUP: “true”
OSIMIS_WEB_VIEWER1_PLUGIN_ENABLED: “true”
labels:
- traefik.enable=true
HTTP Routers
- traefik.http.routers.orthanc-rtr.entrypoints=https
- traefik.http.routers.orthanc-rtr.rule=Host(
pacs.$DOMAINNAME
)
- traefik.http.routers.orthanc-rtr.tls=true
Middlewares
- traefik.http.routers.portainer-rtr.middlewares=chain-no-auth@file # No Authentication
#- traefik.http.routers.portainer-rtr.middlewares=chain-basic-auth@file # Basic Authentication
HTTP Services
- traefik.http.routers.orthanc-rtr.service=orthanc-svc
- traefik.http.services.orthanc-svc.loadbalancer.server.port=80
I’m using the osimis client for their web viewer. Traefik isn’t something I’m too familiar with but I was instructed to use these on our server to route the traffic, I believe.
I’ve also attached my config file. I redacted some of the info for security purposes.
I’ll add any additional details here that I can think might help.
UFW firewall is only allowing ports on 22, 443, and 80
When I check the logs for orthanc, I can see activity for loading the web interface. When I try to use curl to get api info, I don’t see any activity in the logs, and my curl response is empty.
Everything is over https for my orthanc server and my web server. On my other web server, I can curl info from other sites, just not my orthanc setup.
That’s all I can think of atm, let me know if there’s anything else that might be helpful. Again, I really do appreciate the help.
orthanc.json (41.6 KB)
Much better now.
The problem is clearly with “Trafiek”.
Please find attached my patched version of your setup “orthanc.json” and “docker-compose.yml”. This is essentially your files, minus “Trafiek”, minus PostgreSQL, and with the “ports” section fixed in “docker-compose.yml”.
With these two files placed in “/tmp/i”, I start Orthanc as follows in a first terminal:
$ docker-compose up
And in the second terminal, I can successfully contact Orthanc:
$ curl http://alice:alicePassword@localhost:8042/system
{
“ApiVersion” : 9,
“DatabaseBackendPlugin” : null,
“DatabaseVersion” : 6,
“DicomAet” : “ORTHANC”,
“DicomPort” : 4242,
“HttpPort” : 80,
“IsHttpServerSecure” : true,
“Name” : “Orthanc inside Docker2”,
“PluginsEnabled” : true,
“StorageAreaPlugin” : null,
“Version” : “1.8.2”
}
Summarizing, the problem is not within Orthanc (and most probably not in your “orthanc.json”), but within your Docker Compose specifications.
Sébastien-
docker-compose.yml (476 Bytes)
orthanc.json (41.6 KB)
I really do appreciate you taking the time to check this out.