Websocket working in Postman, but not in Chrome - websocket

I am having a spring boot application, where I created some websockets.
I can connect to them on postman via localhost:8080/ws/v1 , but when I try to connect to the websockt in chrome with the following code
let socket = new WebSocket("ws://localhost:8080/ws/v1");
it is not working.
Do you have any idea if the browser has some extra security checks like CORS for http requests that I need to handle?

I am suspecting the culprit might be not using a secure connection. (wss:// not ws://)
Have seen a bunch of posts saying chrome does not allow unsecured websockets.

Related

How to subscribe websocket by Chrome extensions?

I am try to implement a basic web socket app by following this tutorial:https://spring.io/guides/gs/messaging-stomp-websocket/
However, in that tutorial there was a client UI implementation. I don't want to use UI. Instead of the UI, I want to use a websocket client extension in Chrome for sending and seeing messages.
All codes same with the tutorial(except the UI part since I'dont want UI), so I don't rewrite all codes here.
I am able to connect and send message to the url: ws://localhost:8081/gs-guide-websocket for example,
However, I can't get response with this url: ws://localhost:8081/topic/greetings. (I use this URL for getting responses by subscribing it. Because this topic/greetings path used in the UI side of that tutorial for subscription)
The Chrome extension that I used is Simple WebSocket Client.
Why I couldn't subscribe the ws://localhost:8081/topic/greetings url? and How can I get messages from the server by using the Chrome client websocket extensions?
Your application works with STOMP and SockJs, this plugin does not support that. It only works with ws. In this example, you can write a simple ws endpoint for your application:
example simple ws endpoint

different web browser get different response when use websocket

I want connection to a websocket server wss://fm.missevan.com:3016/ws。i use online websocket tool http://www.websocket-test.com to do it, but in edge browser, it's response is ok and in chrome ,the response is 403 forbidden.
Actually, i use GO language to connection wss://fm.missevan.com:3016/ws,I tried many websocket library but all failed.
I checked the request header of connected browser, there are no special fields. so who can analyze the reason of this, thanks

javax.websocket.DeploymentException: The HTTP response from the server [HTTP/1.1 200 OK ] did not permit the HTTP upgrade to WebSocket

I have question, i'm make application REST API spring for fingerprint using websocket, i have already tried to connect websocket and that's work using button click from interface but after i tried to connect to websocket from localhost:8080/filename/1 url bar always showing, did not permit the HTTP upgrade to websocket can someone help me, thanks in advance.

Browser not responding to www-authenticate challenge for bookmarked ssl (https url) to restricted resource

I have set up SSO using weblogic on windows and Kerberos, It is working fine for the http pages, however I observed a strange behavior on https pages which requires CONFIDENTIAL setting for the transport, It works fine if I first access a page on http which is not configured as secured in web.xml(Transport-Gurantee as None) and then the https page.
But If I try to hit the https url directly which is configured with Transport-Gurantee as CONFIDENTIAL then it shows the Basic Auth Dialog and a 401 Unauthorized response, Looking at the logs I see that the Server responded with the WWW-Authenticate but browser showed the Basic Auth Dialog in response instead of getting the Authorize token.
Does anyone has any idea on what might be issue here, If there is any problem with the browser settings then it would not have worked irrespective of accessing the http url first.
I can see the following error log in weblogic console
Malformed request "Can not parse URI from http request". Request parsing failed, Code: -1
Found one of the link here
SPNEGO on IBM WebSphere Portal 6.1 with https
For my case it is weblogic 12c , I don't think reinstalling 12c is a valid solution for it
Ok I got it fixed , It turns out to be an issue with the browser configuration , the https://myserver.domain.com was not inside the intranet domain and the control to do that rests with the windows Admin team, once they added it , the https urls are also working fine.

How do I capture https requests with Postman native app using Windows 10?

I am using the Postman native app on Windows 10 and am struggling with trying to capture https requests. Postman's Documentation for this is for Mac and not Windows.
In particular, I am working on a web application that creates a session cookie upon login that needs to be included in most requests in order to be authorized. When I was using the Chrome App, Postman Interceptor achieved this (see https://stackoverflow.com/a/32436131/3816779).
Here's what I've tried so far:
Turn on the Proxy in Postman with port 5555.
Configured windows to send http and https requests through Postman's proxy server (127.0.0.1:5555).
This allows http requests to be captured in Postman
But when trying to connect to https sites, I get an error
Here are my Postman settings if that helps.
Update I ended up switching back to the Chrome App, which uses the "Interceptor" instead of a "Proxy Server" to capture traffic.
Unfortunately, capture https requests with postman native app is impossible in some case according to the official doc: Capturing HTTP requests
Note: for the Postman native apps, request captures over HTTPS will not work if the website has HSTS enabled. Most websites have this check in place.
Postman's proxy now supports HTTPS traffic - https://blog.postman.com/postmans-proxy-now-fully-supports-https-endpoints/
Once you install a CA certificate that Postman generates for your installation, capturing HTTPS requests should be seamless.
Disclaimer: I work at Postman
With Google Chrome i don't know how to fix the issue. But you can use to open the web page for example IE..
EDIT:
Or MAYBE you can start Google Chrome with parameter --ignore-certificate-errors to ignore the error message.
Postman Interceptor is available for Postman native apps which supports both features:
1. Capturing requests
2. Syncing cookies
Learn more here.
Just check HTTPS in setting and will work for you

Resources