Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

https url changed to http and connection with https #22

Open
MicheleBortol opened this issue Sep 13, 2022 · 6 comments
Open

https url changed to http and connection with https #22

MicheleBortol opened this issue Sep 13, 2022 · 6 comments

Comments

@MicheleBortol
Copy link

Dear all,

When I tryto connect to our OMERO server through the extension with:
Extensions > OMERO > Browse server > New server and then pasting the URL I use for OMERO web:
https://dkfz-omero-test.de I get the following error:

OpenJDK 64-Bit Server VM warning: Option --illegal-access is deprecated and will be removed in a future release.
Sep 13, 2022 9:17:17 AM com.sun.javafx.application.PlatformImpl startup
WARNING: Unsupported JavaFX configuration: classes were loaded from 'unnamed module @61ce23ac'
09:17:17.424 [JavaFX Application Thread] [INFO ] qupath.lib.common.ThreadTools - Setting parallelism to 7
09:17:17.722 [JavaFX Application Thread] [INFO ] qupath.lib.gui.QuPathGUI - QuPath build: Version: 0.3.2
Build time: 2022-01-17, 08:49
Latest commit tag: '71884c6'
09:17:17.723 [JavaFX Application Thread] [INFO ] qupath.lib.gui.QuPathGUI - Setting tile cache size to 2013.00 MB (25.0% max memory)
09:17:18.607 [JavaFX Application Thread] [INFO ] qupath.lib.gui.ExtensionClassLoader - Refreshing extensions in C:\Users\m031i\QuPath\v0.3\extensions
09:17:18.610 [JavaFX Application Thread] [INFO ] qupath.lib.gui.ExtensionClassLoader - Added extension: C:\Users\m031i\QuPath\v0.3\extensions\qupath-extension-omero-0.3.0.jar
09:17:18.627 [JavaFX Application Thread] [INFO ] qupath.lib.scripting.QP - Initializing type adapters
09:17:19.514 [JavaFX Application Thread] [INFO ] q.l.i.s.b.BioFormatsOptionsExtension - Bio-Formats version 6.7.0
09:17:19.517 [JavaFX Application Thread] [INFO ] qupath.lib.gui.QuPathGUI - Loaded extension Bio-Formats options (Bio-Formats 6.7.0) (15 ms)
09:17:19.566 [JavaFX Application Thread] [INFO ] qupath.lib.gui.QuPathGUI - Loaded extension ImageJ extension (49 ms)
09:17:19.571 [JavaFX Application Thread] [INFO ] qupath.lib.gui.QuPathGUI - Loaded extension OMERO extension (3 ms)
09:17:19.593 [JavaFX Application Thread] [INFO ] qupath.lib.gui.QuPathGUI - Loaded extension Processing extension (22 ms)
09:17:19.655 [JavaFX Application Thread] [INFO ] qupath.lib.gui.QuPathGUI - Loaded extension Rich script editor extension (62 ms)
09:17:19.656 [JavaFX Application Thread] [INFO ] qupath.lib.gui.QuPathGUI - Loaded extension SVG export extension (0 ms)
09:17:20.306 [JavaFX Application Thread] [INFO ] q.l.i.s.o.OpenslideServerBuilder - OpenSlide version 3.4.1
09:17:20.374 [qupathgui-1] [INFO ] qupath.lib.gui.QuPathGUI - Update check for https://github.com/qupath/qupath
09:17:20.375 [JavaFX Application Thread] [INFO ] qupath.lib.gui.QuPathApp - Starting QuPath with parameters: []
09:17:20.894 [qupathgui-1] [INFO ] qupath.lib.gui.QuPathGUI - Update check for https://github.com/qupath/qupath-extension-omero
09:17:42.917 [JavaFX Application Thread] [ERROR] q.l.i.servers.omero.OmeroWebClient - Could not reach http://dkfz-omero-test.de/api/v0/. Source permanently moved to https://dkfz-omero-test.de/api/v0/
09:17:42.921 [JavaFX Application Thread] [ERROR] qupath.lib.gui.dialogs.Dialogs - OMERO web server: 301: Moved Permanently

So it seems that the url is converted from https to http before the request is made to the server.
This requested is redirected by our nginx setup to the same url in https with a 301 redirection. Could you confirm if I am interpreting this correctly?

Interestingly, when I change the redirection code in our nginx config from a 301 to a 302 it seems that the response is accepted, but then I immediately get the following error.

OpenJDK 64-Bit Server VM warning: Option --illegal-access is deprecated and will be removed in a future release.
Sep 12, 2022 11:37:34 AM com.sun.javafx.application.PlatformImpl startup
WARNING: Unsupported JavaFX configuration: classes were loaded from 'unnamed module @61ce23ac'
11:37:35.012 [JavaFX Application Thread] [INFO ] qupath.lib.common.ThreadTools - Setting parallelism to 7
11:37:35.287 [JavaFX Application Thread] [INFO ] qupath.lib.gui.QuPathGUI - QuPath build: Version: 0.3.2
Build time: 2022-01-17, 08:49
Latest commit tag: '71884c6'
11:37:35.288 [JavaFX Application Thread] [INFO ] qupath.lib.gui.QuPathGUI - Setting tile cache size to 2013.00 MB (25.0% max memory)
11:37:36.231 [JavaFX Application Thread] [INFO ] qupath.lib.gui.ExtensionClassLoader - Refreshing extensions in C:\Users\m031i\QuPath\v0.3\extensions
11:37:36.233 [JavaFX Application Thread] [INFO ] qupath.lib.gui.ExtensionClassLoader - Added extension: C:\Users\m031i\QuPath\v0.3\extensions\qupath-extension-omero-0.3.0.jar
11:37:36.240 [JavaFX Application Thread] [INFO ] qupath.lib.scripting.QP - Initializing type adapters
11:37:37.163 [JavaFX Application Thread] [INFO ] q.l.i.s.b.BioFormatsOptionsExtension - Bio-Formats version 6.7.0
11:37:37.167 [JavaFX Application Thread] [INFO ] qupath.lib.gui.QuPathGUI - Loaded extension Bio-Formats options (Bio-Formats 6.7.0) (13 ms)
11:37:37.211 [JavaFX Application Thread] [INFO ] qupath.lib.gui.QuPathGUI - Loaded extension ImageJ extension (44 ms)
11:37:37.216 [JavaFX Application Thread] [INFO ] qupath.lib.gui.QuPathGUI - Loaded extension OMERO extension (4 ms)
11:37:37.236 [JavaFX Application Thread] [INFO ] qupath.lib.gui.QuPathGUI - Loaded extension Processing extension (19 ms)
11:37:37.299 [JavaFX Application Thread] [INFO ] qupath.lib.gui.QuPathGUI - Loaded extension Rich script editor extension (62 ms)
11:37:37.301 [JavaFX Application Thread] [INFO ] qupath.lib.gui.QuPathGUI - Loaded extension SVG export extension (1 ms)
11:37:37.872 [JavaFX Application Thread] [INFO ] q.l.i.s.o.OpenslideServerBuilder - OpenSlide version 3.4.1
11:37:37.936 [qupathgui-1] [INFO ] qupath.lib.gui.QuPathGUI - Update check for https://github.com/qupath/qupath
11:37:37.938 [JavaFX Application Thread] [INFO ] qupath.lib.gui.QuPathApp - Starting QuPath with parameters: []
11:37:38.673 [qupathgui-1] [INFO ] qupath.lib.gui.QuPathGUI - Update check for https://github.com/qupath/qupath-extension-omero
11:37:52.986 [JavaFX Application Thread] [ERROR] qupath.lib.gui.dialogs.Dialogs - QuPath exception: java.lang.IllegalStateException: Expected BEGIN_OBJECT but was STRING at line 1 column 1 path $
com.google.gson.JsonSyntaxException: java.lang.IllegalStateException: Expected BEGIN_OBJECT but was STRING at line 1 column 1 path $
        at com.google.gson.Gson.fromJson(Gson.java:975)
        at com.google.gson.Gson.fromJson(Gson.java:928)
        at com.google.gson.Gson.fromJson(Gson.java:877)
        at qupath.lib.images.servers.omero.OmeroWebClient.parseJSON(OmeroWebClient.java:519)
        at qupath.lib.images.servers.omero.OmeroWebClient.loadURLs(OmeroWebClient.java:479)
        at qupath.lib.images.servers.omero.OmeroWebClient.<init>(OmeroWebClient.java:138)
        at qupath.lib.images.servers.omero.OmeroWebClient.create(OmeroWebClient.java:125)
        at qupath.lib.images.servers.omero.OmeroWebClients.createClientAndLogin(OmeroWebClients.java:150)
        at qupath.lib.images.servers.omero.OmeroExtension.lambda$createServerListMenu$1(OmeroExtension.java:159)
        at com.sun.javafx.event.CompositeEventHandler.dispatchBubblingEvent(CompositeEventHandler.java:86)
        at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:234)
        at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:191)
        at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:58)
        at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
        at com.sun.javafx.event.EventUtil.fireEventImpl(EventUtil.java:74)
        at com.sun.javafx.event.EventUtil.fireEvent(EventUtil.java:49)
        at javafx.event.Event.fireEvent(Event.java:198)
        at javafx.scene.control.MenuItem.fire(MenuItem.java:459)
        at com.sun.javafx.scene.control.ContextMenuContent$MenuItemContainer.doSelect(ContextMenuContent.java:1385)
        at com.sun.javafx.scene.control.ContextMenuContent$MenuItemContainer.lambda$createChildren$12(ContextMenuContent.java:1338)
        at com.sun.javafx.event.CompositeEventHandler$NormalEventHandlerRecord.handleBubblingEvent(CompositeEventHandler.java:247)
        at com.sun.javafx.event.CompositeEventHandler.dispatchBubblingEvent(CompositeEventHandler.java:80)
        at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:234)
        at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:191)
        at com.sun.javafx.event.CompositeEventDispatcher.dispatchBubblingEvent(CompositeEventDispatcher.java:59)
        at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:58)
        at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
        at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
        at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
        at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
        at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
        at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
        at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
        at com.sun.javafx.event.EventUtil.fireEventImpl(EventUtil.java:74)
        at com.sun.javafx.event.EventUtil.fireEvent(EventUtil.java:54)
        at javafx.event.Event.fireEvent(Event.java:198)
        at javafx.scene.Scene$MouseHandler.process(Scene.java:3897)
        at javafx.scene.Scene.processMouseEvent(Scene.java:1878)
        at javafx.scene.Scene$ScenePeerListener.mouseEvent(Scene.java:2623)
        at com.sun.javafx.tk.quantum.GlassViewEventHandler$MouseEventNotification.run(GlassViewEventHandler.java:411)
        at com.sun.javafx.tk.quantum.GlassViewEventHandler$MouseEventNotification.run(GlassViewEventHandler.java:301)
        at java.base/java.security.AccessController.doPrivileged(Unknown Source)
        at com.sun.javafx.tk.quantum.GlassViewEventHandler.lambda$handleMouseEvent$2(GlassViewEventHandler.java:450)
        at com.sun.javafx.tk.quantum.QuantumToolkit.runWithoutRenderLock(QuantumToolkit.java:424)
        at com.sun.javafx.tk.quantum.GlassViewEventHandler.handleMouseEvent(GlassViewEventHandler.java:449)
        at com.sun.glass.ui.View.handleMouseEvent(View.java:557)
        at com.sun.glass.ui.View.notifyMouse(View.java:943)
        at com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
        at com.sun.glass.ui.win.WinApplication.lambda$runLoop$3(WinApplication.java:184)
        at java.base/java.lang.Thread.run(Unknown Source)
Caused by: java.lang.IllegalStateException: Expected BEGIN_OBJECT but was STRING at line 1 column 1 path $
        at com.google.gson.stream.JsonReader.beginObject(JsonReader.java:384)
        at com.google.gson.internal.bind.MapTypeAdapterFactory$Adapter.read(MapTypeAdapterFactory.java:183)
        at com.google.gson.internal.bind.MapTypeAdapterFactory$Adapter.read(MapTypeAdapterFactory.java:145)
        at com.google.gson.Gson.fromJson(Gson.java:963)
        ... 49 common frames omitted

I am on windows 10 with QuPath 0.32 and the Omero Extension 0.3 connecting to OMERO.web 5.11.0 (OMERO.server 5.6.3-ice36-b228).

Is there a way to use the extension to connect to OMERO using https? Or another way around these errors?
Thank you.

Best,

Michele

@petebankhead
Copy link
Member

Hi @MicheleBortol

From a quick look at the code, it seems the URL is being selected here:
https://github.com/qupath/qupath-extension-omero/blob/6fa7ac5c4801cceca032b97fbe267a638253ed80/src/main/java/qupath/lib/images/servers/omero/OmeroExtension.java#L151

So my guess is that the http version is being returned via an API request as documented at https://docs.openmicroscopy.org/omero/5.6.0/developers/json-api.html#list-starting-urls

I don't know if there's any reason why those aren't https.

I feel like QuPath ought to be getting the server URL to use from the API... so if https://dkfz-omero-test.de/api/v0/ doesn't return something usable, I'm not sure what should be done about that on the QuPath side.

(PS. The person who did most of the recent work on the OMERO extension left some months ago, and it is likely to take a bit of time before it's actively maintained again. I started some major refactoring because of #21 but I'm not really on top of the code yet - and it may take a while before I can get back to it.)

@petebankhead
Copy link
Member

Linking to the original discussion: https://forum.image.sc/t/qupath-omero-login-problem/71577

@MicheleBortol
Copy link
Author

Hi @petebankhead,

Thank you for your reply. You are correct all the urls returned by: https://dkfz-omero-test.de/api/v0/ are correct but are all http and not https. So it seems like QuPath is getting back urls it can't use. I'll have a look at our OMERO.server and OMERO.web configurations to see if I can make them return https urls. I will post an update when I find something.
Thank you for looking into this.

@mkreisel
Copy link

Any updates on this? I am encountering the same issue. Thanks.

@sbesson
Copy link

sbesson commented Mar 29, 2023

@MicheleBortol @mkreisel we came across this issue recently ourselves. You are correct that the underlying issue with the current qupath-extension-omero is that the URLs reported by the OMERO.web api endpoint should be https when the initial request is https.

Solving this is rather an OMERO.web/nginx configuration issue than a QuPath issue. If nothing else works, you should be able to set the internal property omero.web.api.absolute_url to specify the base URI that should be used for these values.
By default, this value is None and OMERO.web will internally use request.build_absolute_uri() to construct the base URI. One of the critical things we add to fix our own use case is to ensure that the X-Forwarded-Proto header is set appropriately.

Independently of the Web/nginx configuration, it also feels like qupath-extension-omero could more gracefully handle the 301 response especially if the case like this one where the protocol is redirected from http to https.

@MicheleBortol
Copy link
Author

@mkreisel @sbesson
Really sorry for the long delay, I replied in the image.sc forum and completely forgot about the linked github issue:
https://forum.image.sc/t/qupath-omero-login-problem/71577/8?u=michele_bortolomeazz

Setting the omero web config property: omero.web.api.absolute_url to our https:// address solved the issue for us. In our case we had no issues with the X-Forwarded-Proto header.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants