You are not logged in.
Pages: 1
Hi everyone...
I have a situation where I already developed a WebSnap app on Delphi. I'm adding a basic Websock to reduce the number of status request. So far so good.
Problem 1... The main connection is https, therefore when Chrome rejects the web socket connection (since is not secured or wss)... so I tried to set up the application behind IIS using URL Rewrite, and the main application answer correctly, however, I can't make it work for the web socket... Even if the main connection is not secure... I could not get URL Rewrite to work... so I tried with ARR... no success either. I've seen some other people doing it with Apache and Nginx, but not so simple on IIS.
Question one...
Have anyone been able to set up the web socket with either URL Rewrite or ARR?
I saw another post describing the use of HttpPlatformHandler (https://synopse.info/forum/viewtopic.php?id=4249
since this would require to modify my application out of WebSnap to implement the THttpServer...
Is there any guidance to port from either webSnap/webBroaker?
Would the WebSocket work on this IIS interface (HttpPlatformHandler)?
Also, since currently the WebSocket use its own component... can I join both regular THttpServer and TWebSocketServer on the same port?
Thanks,
Luis
Offline
We usually put a nginx server for the TLS (https + wws) process in front of the mORMot web server.
Do you join both https + wss under the same port? or you separate the wss port differently?
Offline
ab wrote:We usually put a nginx server for the TLS (https + wws) process in front of the mORMot web server.
Do you join both https + wss under the same port? or you separate the wss port differently?
Yes, I can (use the same port for WebSocket and normal web server stuff)...
// normal WebSocket stuff...
FProtocol := TWebSocketProtocolEcho.Create('chat','');
FProtocol.OnIncomingFrame := EchoFrame;
FServer.WebSocketProtocols.Add(FProtocol);
// here is where I can plug in my web stuff...
FServer.OnRequest := Process;
My next step is to port WebSnap structure into THttpServer.OnRequest... adjust the use of cookies, query strings, content strings, and headers...
I need to do a few test... but I might try this route first... If this works out, it not only allows me to add websocket, but also improve performance and stability overall on the software.
I've heard good things about nginx, and is in the back of my head, but I'm not too "IT iliterate", and don't want to add more complexity to this project.
I'll post the result sometime early next week!
Tks!
Offline
Yes, as far as I know at least several forum member did, including me, and I posted a link to a working tutorial. Please search the old forum post.
Last edited by edwinsn (2018-12-02 03:24:14)
Delphi XE4 Pro on Windows 7 64bit.
Lazarus trunk built with fpcupdelux on Windows with cross-compile for Linux 64bit.
Offline
The application does work under this platform, but the web socket does not... I've tried adding/removing web socket from iis, disabling from the web config, but no success yet. Later on I'll post the Chrome headers.
Offline
Request
Accept-Encoding: gzip, deflate
Accept-Language: en-US,en;q=0.9,es;q=0.8
Cache-Control: no-cache
Connection: Upgrade
Host: local.aural9.com
Origin: file://
Pragma: no-cache
Sec-WebSocket-Extensions: permessage-deflate; client_max_window_bits
Sec-WebSocket-Key: K7iGrAHp7aaHBhoiQG2WAA==
Sec-WebSocket-Protocol: chat
Sec-WebSocket-Version: 13
Upgrade: websocket
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.110 Safari/537.36
Response
Date: Sun, 02 Dec 2018 13:12:14 GMT
Transfer-Encoding: chunked
Upgrade: websocket
X-Powered-By: ASP.NET
and the error message is
WebSocket connection to 'ws://localhost/socket.io/chat/' failed: Error during WebSocket handshake: 'Sec-WebSocket-Accept' header is missing
Offline
Pages: 1