Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Help] Realtime HTML not working #1577

Closed
giopas opened this issue Oct 23, 2019 · 6 comments
Closed

[Help] Realtime HTML not working #1577

giopas opened this issue Oct 23, 2019 · 6 comments

Comments

@giopas
Copy link

@giopas giopas commented Oct 23, 2019

Hi,

I am trying to use goaccess to analyse logs from Caddy.

GoAccess v. 1.3

GoAccess starting path:

goaccess --no-global-config -o /share/Web/goaccess/index.html --real-time-html --config-file=/share/Public/script/goaccess/goaccess.conf --geoip-database /share/Public/script/goaccess/GeoIP/GeoLite2-City.mmdb

goaccess.conf:

port 7890
daemonize true
log-format COMMON
real-time-html true
log-file /share/Public/Caddy/access.log
output /share/Web/goaccess/index.html
agent-list true
no-query-string true

Problem:

I can access from the browser the index.http file, but it does not update.

The console error I receive is the following:

WebSocket connection to 'wss://[my ip]:7890/' failed: Establishing a tunnel via proxy server failed.
setWebSocket @ (index):27
initialize @ (index):27
window.onload @ (index):27

What am I doing wrong?

Thanks!

@GainfulShrimp

This comment has been minimized.

Copy link

@GainfulShrimp GainfulShrimp commented Oct 23, 2019

From this snippet of the error that you shared... connection to 'wss://[my ip]:7890/' failed, it looks like your browser is trying to make a secure websockets connection (i.e. wss: not ws:) to gwsocket.

For that to work, you'll either need to compile goaccess for TLS and configure it with a cert and key, or you'll need to reverse-proxy the websocket server using Nginx (or, in your case, Caddy, if it supports reverse-proxying websockets) - and have the webserver configured for TLS.

@giopas

This comment has been minimized.

Copy link
Author

@giopas giopas commented Oct 23, 2019

Hi!

Thanks for the quick feedback! Indeed, I am connecting through a TLS reverse proxy. But generally everything is handled by Caddy (which automatically registers through Letsencrypt and ensures automatic http to https redirect).

If I connect through HTTP it seems working (but I will double check).

What would I need to change on goaccess in case I want to connect through TLS?

Thanks

@giopas

This comment has been minimized.

Copy link
Author

@giopas giopas commented Oct 31, 2019

So, here is what I tried:

On caddy.conf:

sub.domain.com {
       import gzipconf
       import addheader
       log /share/Public/GoAccessLogs/goaccess-access.log
       proxy / http://192.168.10.37:82 {
                keepalive 32
                transparent
                websocket
        }
}

wss.domain.com {
       import gzipconf
       import addheader
       log /share/Public/GoAccessLogs/goaccess-access.log
       proxy / http://192.168.10.37:7890 {
                keepalive 32
                transparent
                websocket
        }
}

On the start goaccess script:

goaccess --no-global-config -o /share/Web/goaccess/index.html --real-time-html --config-file=/share/Public/script/goaccess/goaccess.conf --geoip-database /share/Public/script/goaccess/GeoIP/GeoLite2-City.mmdb --ws-url=wss://wss.domain.com

However, I still do not get the green dot...

On https://www.websocket.org/echo.html the test wss://wss.domain.com says CONNECTED.

What am I missing again?

Edit: by declaring port 443 the issue is solved: --ws-url=wss://wss.domain.com:443.

@giopas

This comment has been minimized.

Copy link
Author

@giopas giopas commented Dec 3, 2019

Question: how can I put --ws-url=wss://wss.domain.com:443 in the config file?

@allinurl

This comment has been minimized.

Copy link
Owner

@allinurl allinurl commented Dec 3, 2019

@giopas simply add (space in between):

ws-url wss://wss.domain.com:443
@allinurl

This comment has been minimized.

Copy link
Owner

@allinurl allinurl commented Dec 3, 2019

Glad that solved the issue. Closing this, feel free to reopen it if needed.

@allinurl allinurl closed this Dec 3, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.