Set Proxy in BlitzGateway

Hi Omer-py users,

I would like to connect to OMERO.server using the BiltzGateway API from a cluster. The connection needs to goes through a proxy. Is there a way to set up a proxy when I defined the connection. Something like:

conn = BlitzGateway(“username”, “password”, host=“localhost”, port=4064, poxy="")

Thanks,
George.

Hi @georgefzakinih

There is no such constructor.

OMERO server now support websockets so that could be a way to access the server.

This is the approach we have taken when for example running notebooks on mybinder.org e.g. CalculateSharpnessOneImage.ipynb

Jmarie

Thanks @j.burel

The setup I have on the HPC cluster is that the compute node would reach out the OMERO.server thought another proxy server. Therefore I need to somehow tell the API the ip of the the proxy server. In REST API (e.g., curl) for example, there is a special argument to specify the proxy ip.

I am not familiar with web sockets. Is there a way we can use them to redirect the traffic to a proxy server?

Thanks and regards,
George

What type of proxy do you have in place? Would a SOCKS proxy be an option?
~Josh

Hi @joshmoore ,

The proxy on the HPC compute nodes allow http/s, ftp, and rsync protocols.

Http/s proxy is configured to run on 80, 443, and 8080 ports.

Does that answer your question?

Best regards,
George.

Hi George, it does but it means that SOCKS isn’t supported. We’ve not tried to use websockets via a proxy, but it’s conceivable that it would work: https://doc.zeroc.com/ice/3.6/ice-release-notes/new-features-in-ice-3-6#id-.NewFeaturesinIce3.6v3.6-HTTPProxy

Those properties can be passed to omero.client like this:

client = omero.client([f"--omero.host={ip}", "--omero.user=USERNAME", "--omero.pass=PASSWORD", "--Ice.HTTPProxyHost=127.0.0.1"])
client.createSession()

Thanks @joshmoore, that worked. Here is the complete code snippet is somebody is interested

from omero import client
client = client([f"--omero.host=<omero-server-host>", "--omero.port=<omero-server-port>", "--omero.user=<username>", "--omero.pass=<password>", "--Ice.HTTPProxyHost=<porxy-host>", "--Ice.HTTPProxyPort=<proxy-port>"])
client.createSession()
print("session created")
conn = BlitzGateway(client_obj=client)
for image in conn.getObjects("Image", "<image-id>"):
    print(image.getName())
conn.close()

Best regards,
George.

1 Like

Hi,

Rekindling this discussion to ask if it’s possible to user the omero java client to connect via a proxy?

All the best

1 Like

Hi @oburri,

In Java, you can use the same Ice.HTTPProxyHost and Ice.HTTPProxyHostPort arguments by passing them to the String[] constructor for `LoginCredentials

These are passed to the omero.client constructor as in the Python example above:

~Josh

2 Likes

Dear Josh,

Thanks for the information. It is possible to do this via OMERO.Insight?
I tried

C:\OMERO.insight>OMERO.insight.exe --Ice.HTTPProxyHost=PROXY --I
ce.HTTPProxyPort=PORT

But to no avail. Is there another way?

Best

Oli

Dear @oburri
Unfortunately it will not work using insight,
insight does not handle such use case.
We will need to adjust the way insight is launched to read an ice.config file where such values will be added.

If you need to retrieve data using the Proxy, it will have to be done via a script at the moment

Jmarie

1 Like

Thanks so much for the information.

If you ever decide to go through the points you mention above, we would be most grateful. In the meantime we will work via scripts
All the best