allinurl / gwsocket

fast, standalone, language-agnostic WebSocket server RFC6455 compliant
http://gwsocket.io
MIT License
745 stars 67 forks source link

Getting HTTP ERROR 400 #19

Closed shashank-ssriva closed 3 years ago

shashank-ssriva commented 5 years ago

Whenever I try to access gwsocket web UI, I receive HTTP ERROR 400. I am using gwsocket-0.3.

Below is the message that appears on the browser.

This page isn’t working If the problem continues, contact the site owner.
HTTP ERROR 400
allinurl commented 5 years ago

Can I ask what do you mean with gwsocket Web UI? Thanks

shashank-ssriva commented 5 years ago

Can I ask what do you mean with gwsocket Web UI? Thanks

Ok, sorry. I should have described it more. When I try to access gwsocket in a browser by pointing to the default port, I get this error.

allinurl commented 5 years ago

Can you please post the exact command that you are running so I can try to reproduce this from my end? Thanks.

willkof1 commented 5 years ago

I have the same problem gwsocket --access-log=/var/log/syslog or /var/log/apache2/access.log and yes this is the path of my log.

allinurl commented 5 years ago

I can't reproduce this on my end. Would be able to debug this through gdb?

nickosh commented 3 years ago

Hello. Gwsocket looks great but same problem here. System is WSL1 with Ubuntu 18.04.3 LTS.

I run gwsocket like this: gwsocket --access-log=/tmp/access.log --port=8888

And get a ERROR 400 no matter what I try in browser (like localhost:8888 or localhost:8888/terminal)

In access.log:

127.0.0.1 - - [03/Oct/2020:03:40:44 +0300] "GET / HTTP/1.1" 400 551 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.97 Safari/537.36" 0 127.0.0.1 - - [03/Oct/2020:03:40:44 +0300] "GET / HTTP/1.1" 200 551 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.97 Safari/537.36" 0 127.0.0.1 - - [03/Oct/2020:03:40:52 +0300] "GET /terminal.html HTTP/1.1" 400 650 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.97 Safari/537.36" 0 127.0.0.1 - - [03/Oct/2020:03:40:52 +0300] "GET /terminal.html HTTP/1.1" 200 650 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.97 Safari/537.36" 0 127.0.0.1 - - [03/Oct/2020:03:41:37 +0300] "GET /terminal.html HTTP/1.1" 400 564 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.97 Safari/537.36" 0 127.0.0.1 - - [03/Oct/2020:03:41:37 +0300] "GET /terminal.html HTTP/1.1" 200 564 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.97 Safari/537.36" 0 127.0.0.1 - - [03/Oct/2020:03:41:39 +0300] "GET / HTTP/1.1" 400 637 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.97 Safari/537.36" 0 127.0.0.1 - - [03/Oct/2020:03:41:39 +0300] "GET / HTTP/1.1" 200 637 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.97 Safari/537.36" 0 127.0.0.1 - - [03/Oct/2020:03:41:42 +0300] "GET / HTTP/1.1" 400 663 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.97 Safari/537.36" 0 127.0.0.1 - - [03/Oct/2020:03:41:42 +0300] "GET / HTTP/1.1" 200 663 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.97 Safari/537.36" 0 127.0.0.1 - - [03/Oct/2020:03:42:17 +0300] "GET / HTTP/1.1" 400 551 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.97 Safari/537.36" 0 127.0.0.1 - - [03/Oct/2020:03:42:17 +0300] "GET / HTTP/1.1" 200 551 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.97 Safari/537.36" 0

Any solution?

allinurl commented 3 years ago

I need to apply the fix from goaccess (commit). Are you able to post the request headers?

allinurl commented 3 years ago

Pushed a fix for this. Please feel free to build from development and let me know if that addresses the issue on your end. Thanks.

nickosh commented 3 years ago

Sorry, too late but still, headers:

GET / HTTP/1.1 Host: localhost:8888 Connection: keep-alive Cache-Control: max-age=0 Upgrade-Insecure-Requests: 1 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.97 Safari/537.36 Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,/;q=0.8,application/signed-exchange;v=b3;q=0.9 Sec-Fetch-Site: cross-site Sec-Fetch-Mode: navigate Sec-Fetch-User: ?1 Sec-Fetch-Dest: document Accept-Encoding: gzip, deflate, br Accept-Language: en-US,en;q=0.9

Thanks. I try to build version with fix.

nickosh commented 3 years ago

Build version with fix but still same error. Headers:

Request URL: http://localhost:8888/ Request Method: GET Status Code: 400 Invalid Request Remote Address: 127.0.0.1:8888 Referrer Policy: no-referrer-when-downgrade Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,/;q=0.8,application/signed-exchange;v=b3;q=0.9 Accept-Encoding: gzip, deflate, br Accept-Language: en-US,en;q=0.9 Connection: keep-alive Cookie: Pycharm-c28352c8=f799eca8-17b5-4844-9bbe-bcc6aeab4400; Pycharm-cee2178c=34859c46-54e2-4e86-9f5e-f5b22f0df20a Host: localhost:8888 Sec-Fetch-Dest: document Sec-Fetch-Mode: navigate Sec-Fetch-Site: none Sec-Fetch-User: ?1 Upgrade-Insecure-Requests: 1 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.97 Safari/537.36

franciscopaniskaseker commented 2 years ago

Same problem here.

I installed from git repository.

root@h:~/gwsocket# gwsocket --version
GWSocket 0.4

the command:

root@h:~/gwsocket# gwsocket --access-log=/home/linuxrecipe/web/linux.recipes/logs/linux.recipes.log

I got 400 http error when i try to access ip:7890.

Captura de Tela 2022-02-15 às 16 28 00
allinurl commented 2 years ago

@franciscopaniskaseker Can you please share how you are connecting the client to the WS? also, are you using https or http when opening the client side?

franciscopaniskaseker commented 2 years ago

I am trying to access using http://ip:7890 or http://dns:7890 thorugh last stable google chrome (from mac). The DNS does not has any kind of proxy. last stable firefox and safari got same behavior.

The command is the same:

root@h:~# gwsocket --access-log=/home/linuxrecipe/web/linux.recipes/logs/linux.recipes.log

let me know how can I help to troubleshoot this. The telnet tool can open the conversation with 7890 tcp port.

allinurl commented 2 years ago

@franciscopaniskaseker How about the index page that you are opening when typing http://ip:7890/ ? you'll need to connect via JS through the Web Socket API https://developer.mozilla.org/en-US/docs/Web/API/WebSocket

franciscopaniskaseker commented 2 years ago

The error is the index page. I though that was enough to get access of the log. I understood the error. Is not a bug, then.

allinurl commented 2 years ago

@franciscopaniskaseker no worries. As far as exporting the data from the report, goaccess should already handle this for you. gwsocket would be great for any other data you want to handle from the client to the server or vice-versa. Let me know if you have any additional questions, happy to help :)

franciscopaniskaseker commented 2 years ago

thank you for your time and patience!