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

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.

Related

Websocket working in Postman, but not in Chrome

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.

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

"500 Internal Server Error" returned when sending GET request using HTTP Client in idea

I am trying to test a Spring Boot project using HTTP Client of IDEA to send a GET request, but it return "500 Internal Server Error":
But under the same conditions, it is no problem to send by browser:
There's no problem using postman:
But using postwoman will cause a CORS problem. By default, postwoman run on port 3000, so I add #CrossOrigin(value = "http://localhost:3000") on the controller class. After that, there was no problem with the test:
At the same time, there is no problem sending GET request using VSCode's REST Client plug-in:
The controller class code is as follows:
It's confirmed that it's not a firewall problem, so is this a bug of HTTP Client?
Or does the HTTP client need to set some configuration?
It's a proxy problem. It is HTTP proxy set in IDEA. 500 is returned by the proxy server.

Is there a way to use custom headers when opening WebSocket connection?

I'm trying to make a WSS connection using default karate.webSocket(url, handler);
Connection is successful, but desired host requires Authorization: Bearer XXX header when upgrading connection from https to wss
Is it possible to provide custom HTTP headers from *.feature file for WebSocket connection?
Actually no, we never realized this was needed until now. We've opened an issue: https://github.com/intuit/karate/issues/775 - hope we can count on you to test this.

How to allow https to access content from wowza http link?

I have one question. Recently i have get link from my streaming server to play in my website. My streaming server use http link but my website use https ssl. During i get the link to play it cannot get content from my streaming server by show the following error:
enter image description here
I am looking forward to hearing from all of you soon.
Thanks in advance.
Best Regards,
Chhenghong
This error happens because you cannot access HTTP resource from HTTPS page, for security consideration. It is the browser behaviour.
To fix this issue, a proxy endpoint can be made in server side, such as /proxy/playlist.m3u8, which accept HTTP GET request. The browser will fetch the resource from https://<your-server>/proxy/playlist.m3u8, as if it is stored in your host. As it is an HTTPS request, no error.
In the server side, when GET request to /proxy/playlist.m3u8 is listened, the HTTP request would be proxied to your streaming server (send GET request to the streaming server with all headers, parameters and body). When the response from streaming server is received, the response would be returned to browser directly, with all response headers and data.
As the HTTP request to streaming server happens in your server side, the restriction logic from browser does not apply any more.
For example, if the server is written in Node.js, with Express and request module, the proxy endpoint would look like:
app.get('/proxy/playlist.m3u8', function(req, res) {
req.pipe(request('http://<streaming-server>/path/playlist.m3u8')).pipe(res);
});

Resources