[Solved] How to prevent web socket breakage?
Added by madeleine333 almost 6 years ago
Hello
first of all, I'm really thankful lighttpd developers!
And sorry about I wrote this issue (oversized request header) on bug reporter.
and I received answer.
check below options
- server.max-request-field-size
- server.max-read-idle
- server.max-write-idle
but server.max-requset-field-size (default : 8192)
No matter how I increase the value, the Web socket is broken someday.
keep-alive is not a problem, but request header full.
again,
I use lighttpd 1.4.49 from Embedded linux.
and my web page repeatedly send message to lighttpd (via web socket).
and this process always occur request header full. (then, web socket broken.)
I want to permanently connect the web socket until client close the web socket or web page...
big thanks in advance.
I added next line,
my lighttpd.conf :
server.modules += ("mod_wstunnel")
wstunnel.server = ("" => (("host" => "127.0.0.1", "port" => "80")))
Replies (3)
RE: How to prevent web socket breakage? - Added by gstrauss almost 6 years ago
No matter how I increase the value, the Web socket is broken someday.
Thanks for saying "it is broken for me" with very little additional data.
Please use your favorite search engine and search for "how to ask a good technical question"
keep-alive is not a problem, but request header full.
This is unclear. I understand that English may not be your first language, but we still can not help you if we are unable to understand you.
You are asking questions, so you should withhold your opinions and instead provide observations such as a description of your setup, as well as request and response headers from logs, and error log entries.
RE: How to prevent web socket breakage? - Added by madeleine333 almost 6 years ago
Hi, Thank you for your sincere advice.
I just added a line of code to lighttpd.conf.
so I didn't consider to add any other information.
I'm trying to use mod_wstunnel with lighttpd 1.4.49 to handle websocket connections from javascript clients.
If a web page sends a message to the web server at 1 second intervals, the web socket is broken after 30 minutes.
Raising the 'server.max-requset-field-size' value only delays time.
client:
<script language="javascript" type="text/javascript">
ws = new WebSocket("ws://10.10.20.195");
setInterval(function () {ws.send("test");}, 1000);
</script>
access.log:
10.10.20.191 10.10.20.195 - [24/May/2018:01:00:01 +0000] "GET /ws.html HTTP/1.1" 200 4966 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/67.0.3396.56 Safari/537.36" 127.0.0.1 - - [24/May/2018:01:31:49 +0000] "" 431 327 "-" "-"
error.log :
2018-05-24 01:00:02: (mod_wstunnel.c.493) allowed origins not specified 2018-05-24 01:00:02: (mod_wstunnel.c.594) WebSocket Version = 13 2018-05-24 01:00:02: (mod_wstunnel.c.630) will recv text data from backend 2018-05-24 01:00:02: (mod_wstunnel.c.963) send handshake response 2018-05-24 01:00:02: (mod_wstunnel.c.1288) recv data from client ( fd = 9 ), size = 0x00 2018-05-24 01:00:03: (mod_wstunnel.c.1288) recv data from client ( fd = 9 ), size = 0x00 ... 2018-05-24 01:31:48: (mod_wstunnel.c.1288) recv data from client ( fd = 9 ), size = 0x00 2018-05-24 01:31:49: (mod_wstunnel.c.1288) recv data from client ( fd = 9 ), size = 0x00 2018-05-24 01:31:49: (connections.c.973) oversized request-header -> sending Status 431 2018-05-24 01:31:49: (mod_wstunnel.c.380) recv data from backend ( fd = 10 ), size = 0x01d7 2018-05-24 01:31:49: (mod_wstunnel.c.1216) type = text_send_rfc_6455 2018-05-24 01:31:49: (mod_wstunnel.c.1237) payload size = 0x01d7 2018-05-24 01:31:49: (mod_wstunnel.c.1267) send data to client ( fd = 9 )-----------------, frame size = 0x01db 2018-05-24 01:31:49: (mod_wstunnel.c.380) recv data from backend ( fd = 10 ), size = 0x00
RE: [Solved] How to prevent web socket breakage? - Added by gstrauss almost 6 years ago
If lighttpd is running or port 80 and you have wstunnel.server = ("" => (("host" => "127.0.0.1", "port" => "80")))
, then you have a loop. If you are using mod_wstunnel, then you have to provide the web socket server backend.