Closed kylebarron closed 4 years ago
For the record I tried the same command on macOS (the original was on Ubuntu 18.04) and got the same crash message.
@kylebarron sorry for the issue - I haven't had a chance to dig in.
Does the same issue present when you omit the --enable-reload
option?
No rush; I'm not affected by this bug because I'm using Cloudflare for https, but just wanted to let you know.
Yes, it still crashes for me without --enable-reload
:
> mbtileserver -d mbtiles/ -p 443 --tls --domain mydomain.com
INFO[0000] Found 43 mbtiles files in mbtiles/
--------------------------------------
Use Ctrl-C to exit the server
--------------------------------------
HTTPS server started on port 443
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x44acb66]
goroutine 1 [running]:
main.serve()
/Users/kyle/github/go/src/github.com/consbio/mbtileserver/main.go:320 +0xd86
main.glob..func1(0x4baac20, 0xc000324a80, 0x0, 0x7)
/Users/kyle/github/go/src/github.com/consbio/mbtileserver/main.go:48 +0x62
github.com/consbio/mbtileserver/vendor/github.com/spf13/cobra.(*Command).execute(0x4baac20, 0xc000020110, 0x7, 0x7, 0x4baac20, 0xc000020110)
/Users/kyle/github/go/src/github.com/consbio/mbtileserver/vendor/github.com/spf13/cobra/command.go:766 +0x2aa
github.com/consbio/mbtileserver/vendor/github.com/spf13/cobra.(*Command).ExecuteC(0x4baac20, 0x0, 0x0, 0x0)
/Users/kyle/github/go/src/github.com/consbio/mbtileserver/vendor/github.com/spf13/cobra/command.go:852 +0x2ea
github.com/consbio/mbtileserver/vendor/github.com/spf13/cobra.(*Command).Execute(...)
/Users/kyle/github/go/src/github.com/consbio/mbtileserver/vendor/github.com/spf13/cobra/command.go:800
main.main()
/Users/kyle/github/go/src/github.com/consbio/mbtileserver/main.go:145 +0x2d
Per changes under #69, we're referencing server.TLSConfig
which is not defined. We need to initialize it first:
server.TLSConfig = new(tls.Config)
And also make sure that we're using a TLS enabled net.Listener
:
tlsListener := tls.NewListener(listener, server.TLSConfig)
@kylebarron this should now be fixed. I don't have a server handy with a publicly-accessible domain name I'm willing to test on, so feel free to re-open if this breaks for you on your domain name.
It kept crashing for me while testing out the auto-tls: