wok icon indicating copy to clipboard operation
wok copied to clipboard

Nginx throws Bad Request

Open hannonq opened this issue 4 years ago • 1 comments

Describe the bug I followed this guide to install Kimchi on Ubuntu Server 18.04, but when I try to access https://:8001/, I get 400 Bad Request from Nginx.

One thing worth mentioning is that I had to tell Nginx to listen to port 89 instead of the default 80, because I already have a Traefik instance listening on that port. Could this be the problem?

To Reproduce Steps to reproduce the behavior: The exact steps to reproduce are difficult to describe, but I believe that the relevant parts are:

  1. Follow the mentioned tutorial to install Kimchi on a Ubuntu Server 18.04
  2. Change Nginx port to 89
  3. Try to access the server

Expected behavior I expected to see Kimchi login page

Desktop (please complete the following information):

  • OS: Ubuntu Server 18.04
  • Browser: Chrome and Safari
  • Version 2.5

Additional context Wok seems to be running correctly:

service wokd status
● wokd.service - Wok - Webserver Originated from Kimchi
   Loaded: loaded (/lib/systemd/system/wokd.service; enabled; vendor preset: enabled)
  Drop-In: /etc/systemd/system/wokd.service.d
           └─kimchi.conf
   Active: active (running) since Tue 2019-12-10 21:50:04 CET; 39min ago
     Docs: https://github.com/kimchi-project/wok/wiki
 Main PID: 1606 (python2)
    Tasks: 17 (limit: 4915)
   CGroup: /system.slice/wokd.service
           ├─1606 python2 /usr/bin/wokd
           └─1717 python2 /usr/bin/wokd

Dec 10 21:50:04 nuc systemd[1]: Started Wok - Webserver Originated from Kimchi.

And I can't make sense of the error logs. Is there anything relevant here to point me to where this error is coming from?

cat /var/log/nginx/error.log

2019/12/10 21:22:49 [debug] 11392#11392: *18 write new buf t:1 f:0 0000561157C66950, pos 0000561157C66950, size: 161 file: 0, size: 0
2019/12/10 21:22:49 [debug] 11392#11392: *18 http write filter: l:0 f:0 s:161
2019/12/10 21:22:49 [debug] 11392#11392: *18 http output filter "/?"
2019/12/10 21:22:49 [debug] 11392#11392: *18 http copy filter: "/?"
2019/12/10 21:22:49 [debug] 11392#11392: *18 http postpone filter "/?" 0000561157C66B80
2019/12/10 21:22:49 [debug] 11392#11392: *18 write old buf t:1 f:0 0000561157C66950, pos 0000561157C66950, size: 161 file: 0, size: 0
2019/12/10 21:22:49 [debug] 11392#11392: *18 write new buf t:0 f:0 0000000000000000, pos 0000561156CC1D60, size: 218 file: 0, size: 0
2019/12/10 21:22:49 [debug] 11392#11392: *18 write new buf t:0 f:0 0000000000000000, pos 0000561156CC30A0, size: 62 file: 0, size: 0
2019/12/10 21:22:49 [debug] 11392#11392: *18 write new buf t:0 f:0 0000000000000000, pos 0000561156CC2E80, size: 402 file: 0, size: 0
2019/12/10 21:22:49 [debug] 11392#11392: *18 http write filter: l:1 f:0 s:843
2019/12/10 21:22:49 [debug] 11392#11392: *18 http write filter limit 0
2019/12/10 21:22:49 [debug] 11392#11392: *18 writev: 843 of 843
2019/12/10 21:22:49 [debug] 11392#11392: *18 http write filter 0000000000000000
2019/12/10 21:22:49 [debug] 11392#11392: *18 http copy filter: 0 "/?"
2019/12/10 21:22:49 [debug] 11392#11392: *18 http finalize request: 0, "/?" a:1, c:1
2019/12/10 21:22:49 [debug] 11392#11392: *18 http request count:1 blk:0
2019/12/10 21:22:49 [debug] 11392#11392: *18 http close request
2019/12/10 21:22:49 [debug] 11392#11392: *18 http log handler
2019/12/10 21:22:49 [debug] 11392#11392: *18 free: 0000561157C65B90, unused: 0
2019/12/10 21:22:49 [debug] 11392#11392: *18 free: 0000561157C59C60, unused: 2790
2019/12/10 21:22:49 [debug] 11392#11392: *18 close http connection: 21
2019/12/10 21:22:49 [debug] 11392#11392: *18 reusable connection: 0
2019/12/10 21:22:49 [debug] 11392#11392: *18 free: 0000561157CE2BA0
2019/12/10 21:22:49 [debug] 11392#11392: *18 free: 0000561157CE8B50
2019/12/10 21:22:49 [debug] 11392#11392: *18 free: 0000561157C5C6E0, unused: 24
2019/12/10 21:22:49 [debug] 11392#11392: accept on 0.0.0.0:8001, ready: 0
2019/12/10 21:22:49 [debug] 11392#11392: posix_memalign: 0000561157C5C6E0:512 @16
2019/12/10 21:22:49 [debug] 11392#11392: *19 accept: 192.168.178.7:49669 fd:21
2019/12/10 21:22:49 [debug] 11392#11392: *19 event timer add: 21: 60000:2040207
2019/12/10 21:22:49 [debug] 11392#11392: *19 reusable connection: 1
2019/12/10 21:22:49 [debug] 11392#11392: *19 epoll add event: fd:21 op:1 ev:80002001
2019/12/10 21:22:49 [debug] 11392#11392: *19 http check ssl handshake
2019/12/10 21:22:49 [debug] 11392#11392: *19 http recv(): 1
2019/12/10 21:22:49 [debug] 11392#11392: *19 plain http
2019/12/10 21:22:49 [debug] 11392#11392: *19 http wait request handler
2019/12/10 21:22:49 [debug] 11392#11392: *19 malloc: 0000561157CE8B50:1024
2019/12/10 21:22:49 [debug] 11392#11392: *19 recv: eof:0, avail:1
2019/12/10 21:22:49 [debug] 11392#11392: *19 recv: fd:21 1024 of 1024
2019/12/10 21:22:49 [debug] 11392#11392: *19 reusable connection: 0
2019/12/10 21:22:49 [debug] 11392#11392: *19 posix_memalign: 0000561157C65B90:4096 @16
2019/12/10 21:22:49 [debug] 11392#11392: *19 http process request line
2019/12/10 21:22:49 [debug] 11392#11392: *19 http request line: "GET /favicon.ico HTTP/1.1"
2019/12/10 21:22:49 [debug] 11392#11392: *19 http uri: "/favicon.ico"
2019/12/10 21:22:49 [debug] 11392#11392: *19 http args: ""
2019/12/10 21:22:49 [debug] 11392#11392: *19 http exten: "ico"
2019/12/10 21:22:49 [debug] 11392#11392: *19 posix_memalign: 0000561157C59C60:4096 @16
2019/12/10 21:22:49 [debug] 11392#11392: *19 http process request header line
2019/12/10 21:22:49 [debug] 11392#11392: *19 http header: "Host: 192.168.178.19:8001"
2019/12/10 21:22:49 [debug] 11392#11392: *19 http header: "Connection: keep-alive"
2019/12/10 21:22:49 [debug] 11392#11392: *19 http header: "Pragma: no-cache"
2019/12/10 21:22:49 [debug] 11392#11392: *19 http header: "Cache-Control: no-cache"
2019/12/10 21:22:49 [debug] 11392#11392: *19 http header: "User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.108 Safari/537.36"
2019/12/10 21:22:49 [debug] 11392#11392: *19 http header: "Accept: image/webp,image/apng,image/*,*/*;q=0.8"
2019/12/10 21:22:49 [debug] 11392#11392: *19 http header: "Referer: http://192.168.178.19:8001/"
2019/12/10 21:22:49 [debug] 11392#11392: *19 http header: "Accept-Encoding: gzip, deflate"
2019/12/10 21:22:49 [debug] 11392#11392: *19 http header: "Accept-Language: en-US,en;q=0.9,pt-BR;q=0.8,pt;q=0.7"
2019/12/10 21:22:49 [debug] 11392#11392: *19 http alloc large header buffer
2019/12/10 21:22:49 [debug] 11392#11392: *19 malloc: 0000561157CE2BA0:8192
2019/12/10 21:22:49 [debug] 11392#11392: *19 http large header alloc: 0000561157CE2BA0 8192
2019/12/10 21:22:49 [debug] 11392#11392: *19 http large header copy: 595
2019/12/10 21:22:49 [debug] 11392#11392: *19 recv: eof:0, avail:1
2019/12/10 21:22:49 [debug] 11392#11392: *19 recv: fd:21 62 of 7597
2019/12/10 21:22:49 [debug] 11392#11392: *19 http header: "Cookie: organizrLanguage=en; _ga=GA1.1.905115716.1574191588; displayShow-pagination-perPage=100; organizr_token_1258e4a4-eb95-452c-ae11-b624920ca962=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiIsImp0aSI6IjRmMWcyM2ExMmFhIn0.eyJpc3MiOiJPcmdhbml6ciIsImF1ZCI6Ik9yZ2FuaXpyIiwianRpIjoiNGYxZzIzYTEyYWEiLCJpYXQiOjE1NzU0OTY5NjUsImV4cCI6MTU3NjEwMTc2NSwidXNlcm5hbWUiOiJoYW5ub25xIiwiZ3JvdXAiOiJBZG1pbiIsImdyb3VwSUQiOjAsImVtYWlsIjoiaGFubm9ucXpAZ21haWwuY29tIiwiaW1hZ2UiOiJodHRwczpcL1wvd3d3LmdyYXZhdGFyLmNvbVwvYXZhdGFyXC85NzU2OTNlNDQ4NTZmODAzMWI2YzllMzAzMjFlZDVjZj9zPTEwMCZkPW1tIiwidXNlcklEIjoxfQ.eBbYeQ-DsA6rrrTOIGeqg0bJPZjjGX0LnFFpOKuqdxI; SID=eZyRwGJ2iueP2OhNRi3lRIgGemgR2xQ5"
2019/12/10 21:22:49 [debug] 11392#11392: *19 http header done
2019/12/10 21:22:49 [info] 11392#11392: *19 client sent plain HTTP request to HTTPS port while reading client request headers, client: 192.168.178.7, server: , request: "GET /favicon.ico HTTP/1.1", host: "192.168.178.19:8001", referrer: "http://192.168.178.19:8001/"
2019/12/10 21:22:49 [debug] 11392#11392: *19 http finalize request: 497, "/favicon.ico?" a:1, c:1
2019/12/10 21:22:49 [debug] 11392#11392: *19 event timer del: 21: 2040207
2019/12/10 21:22:49 [debug] 11392#11392: *19 http special response: 497, "/favicon.ico?"
2019/12/10 21:22:49 [debug] 11392#11392: *19 http set discard body
2019/12/10 21:22:49 [debug] 11392#11392: *19 HTTP/1.1 400 Bad Request
Server: nginx/1.14.0 (Ubuntu)
Date: Tue, 10 Dec 2019 21:22:49 GMT
Content-Type: text/html
Content-Length: 682
Connection: close

And this is my default nginx conf

# Default server configuration
#
server {
	listen 89 default_server;
	listen [::]:89 default_server;
        error_log /var/log/nginx/error.log debug;
	# SSL configuration
	#
	# listen 443 ssl default_server;
	# listen [::]:443 ssl default_server;
	#
	# Note: You should disable gzip for SSL traffic.
	# See: https://bugs.debian.org/773332
	#
	# Read up on ssl_ciphers to ensure a secure configuration.
	# See: https://bugs.debian.org/765782
	#
	# Self signed certs generated by the ssl-cert package
	# Don't use them in a production server!
	#
	# include snippets/snakeoil.conf;

	root /var/www/html;

	# Add index.php to the list if you are using PHP
	index index.html index.htm index.nginx-debian.html;

	server_name _;

	location / {
		# First attempt to serve request as file, then
		# as directory, then fall back to displaying a 404.
		try_files $uri $uri/ =404;
	}

}

Any ideas on how to go about this would be appreciated. Thanks!

hannonq avatar Dec 10 '19 21:12 hannonq

Try to install all dependencies. I had the same issue on Centos. Apparently the compiled packages don't try to resolve dependencies.

scorpio2k2 avatar Dec 28 '19 21:12 scorpio2k2