eclipse-ee4j / glassfish

Eclipse GlassFish
https://eclipse-ee4j.github.io/glassfish/
380 stars 143 forks source link

Secure websockets do not seem to work - HTTP 40 #15279

Closed glassfishrobot closed 13 years ago

glassfishrobot commented 13 years ago

Hello,

I am trying to use secure WebSockets wss:// protocol on glassfish and I am getting the following error:

X-Powered-By: Servlet/3.0 JSP/2.2 (GlassFish Server Open Source Edition 3.1-b32 Java/Sun Microsystems Inc./1.6) Server: GlassFish Server Open Source Edition 3.1-b32 ...... HTTP Status 405 - HTTP method GET is not supported by this URL


type Status report

messageHTTP method GET is not supported by this URL

descriptionThe specified HTTP method is not allowed for the requested resource (HTTP method GET is not supported by this URL).


GlassFish Server Open Source Edition 3.1-b32

It looks like the WebSockets protocol handshake fails. Non-secure WebSockets are not affected from this problem.

Is there a component in glasshfish that performs some SSL offload? Is this component aware of WebSocket? The error above looks like the request has been passed to the Servelet that handlse the WebSockets without the following part Connection: Upgrade\r\n Upgrade: WebSocket\r\n

Please let me know if require testing application or more details

Environment

SSL WebSockets

Affected Versions

[3.1_dev]

glassfishrobot commented 6 years ago
glassfishrobot commented 13 years ago

@glassfishrobot Commented cheeser said: Could you elaborate on your set up and what you're trying to do? Maybe a test application? Also, it would help to know what browser you're using so we can compare spec version numbers, etc. There's a unit test in grizzly that uses wss:// to connect and it's been passing for months. From the sounds of it, you're trying to hit a servlet with a websocket connection and that's not really supported just yet.

glassfishrobot commented 13 years ago

@glassfishrobot Commented ocassetti said: First attachment: WebSocket Simple Echo Application. This application works fine when using non-secure websocket. When using secure websockets it shows the problem HTTP/405 error we mentioned in the description of this issue. There are two parts ie.tcd.scss.cs4032.websocketsT1. is the server side - a simple echo Application. There is also a Java websocket client in local.ws.client. Finally, there is a test caleed WSTest.java which test the wss:// protocol. You might need to set up your keystore using and set up //-Djavax.net.ssl.trustStore= //-Djavax.net.ssl.trustStorePassword=

Second attachment: Java Script Client use sample.html in zip file to run the client

glassfishrobot commented 13 years ago

@glassfishrobot Commented ocassetti said: I added a simple webSocket Application that shows the problem we are experiencing. We are trying to use wss:// in Glassfish 3.1. We are using a java websocket client to talk to the server. However the problem appears also in web browsers such as Firefox 4.0b7, and Google Chrome 10.0.612.1 dev. I would like to see your test as well, if it's possible. Would you be able to tell me where I can check it out? Yes it sounds like I hit a servelt that is not supporting websocket just yet. However the same servlet does support non-secure websockets ws://. Please let me know if I can help you more through the problem

glassfishrobot commented 13 years ago

@glassfishrobot Commented cheeser said: I ran the unit tests this morning in the grizzly tree (where the websocket support actually lives) and the ssl tests passed. you can check that out at https://svn.java.net/svn/grizzly~svn/trunk/code. In modules/websockets, there are a number of tests including at least one for ssl that pass for me. I'll take a look at your attachment and see what comes up.

glassfishrobot commented 13 years ago

@glassfishrobot Commented cheeser said: OK. I just ran your test case and worked on my svn build of glassfish. (Updated as of the last couple of days). I did have to make some tweaks to the pom, though, and that might be where your issues are coming up. The pom, as sent, includes the grizzly and servlet jars in the war and that's a recipe for confusion at best and disaster most of the time. I ended up setting a scope of "provided" for all the dependencies and rebuilding the jar. With that done, there are no jars included in the war file and aren't needed anyway. That jar correctly responds on wss://localhost:8181. Try those changes (I'll attach my copy) and see how it goes.

glassfishrobot commented 13 years ago

@glassfishrobot Commented cheeser said: My update pom

glassfishrobot commented 13 years ago

@glassfishrobot Commented ocassetti said: Thanks for the update. I tried with the new pom on glassfish 3.1b32 and 3.1b33 but I still get the same error. I asked few other people to test this a well to double check this. I will update on this asap

glassfishrobot commented 13 years ago

@glassfishrobot Commented cheeser said: adding 3_1-exclude to this since I don't think the issue affects the 3.1 release. The test code given works on a local build and i'm awaiting further feedback from ocassetti.

glassfishrobot commented 13 years ago

@glassfishrobot Commented ocassetti said: Ok we found the problem: I knew about the need to enable websockets support on listener-1, but I didn't know it needed to be enable on listener-2. The following line fixed my problem asadmin set configs.config.server-config.network-config.protocols.protocol.http-listener-2.http.websockets-support-enabled=true

Thanks again for the help.

Could had this piece of information to the documentation?

glassfishrobot commented 13 years ago

@glassfishrobot Commented cheeser said: Sorry. Didn't see your comment come through on my email. Which docs are you reading?

glassfishrobot commented 13 years ago

@glassfishrobot Commented ocassetti said: Sorry I missed your comment as well for some reason gmail decided that it wasn't priority and didn't display it in my inbox.

I looked into /trunk/code/samples/websockets/chat

and there was no reference about this.

I found out that it's actually reported in Oracle GlassFish Server 3.0.1 Administration Guide

http://download.oracle.com/docs/cd/E19798-01/821-1751/6nmnci5v6/index.html

I suppose that this was the best place to look first.

glassfishrobot commented 13 years ago

@glassfishrobot Commented File: pom.xml Attached By: cheeser

glassfishrobot commented 13 years ago

@glassfishrobot Commented File: WSClientJavaScript.zip Attached By: ocassetti

glassfishrobot commented 13 years ago

@glassfishrobot Commented File: wsT1Dist.tar.gz Attached By: ocassetti

glassfishrobot commented 13 years ago

@glassfishrobot Commented Was assigned to cheeser

glassfishrobot commented 7 years ago

@glassfishrobot Commented This issue was imported from java.net JIRA GLASSFISH-15279

glassfishrobot commented 13 years ago

@glassfishrobot Commented Reported by ocassetti

glassfishrobot commented 13 years ago

@glassfishrobot Commented Marked as fixed on Monday, February 7th 2011, 2:05:43 am