librespeed / speedtest-go

Go backend for LibreSpeed
GNU Lesser General Public License v3.0
727 stars 153 forks source link

Not working properly after Caddy2 #14

Closed wsndshx closed 3 years ago

wsndshx commented 3 years ago

Description

I use Caddy2 to forward access on port 443 to port 8989. I can open the page but cannot perform speed testing.

Caddy Config

speedtest.example.com {
    encode gzip
    root * /speedtest-go/assets
    file_server
    reverse_proxy / localhost:8989 {
        header_up -Origin
    }
}

speedtest settings

speedtest settings are the default

Client

Browser: Chrome 86.0.4240.183, OS: Window 10

Steps to reproduce

Expected behaviour

The file should be downloaded from the server and the speed measured.

Screenshots

Snipaste_2020-11-05_22-44-08
maddie commented 3 years ago

I'm not sure about Caddy's configuration, maybe try to remove the root * /speedtest-go/assets line? And what does the file_server line do?

The assets should be served by the Go backend instead of Caddy, so can just forward all requests to the backend.

wsndshx commented 3 years ago

I'm not sure about Caddy's configuration, maybe try to remove the root * /speedtest-go/assets line? And what does the file_server line do?

The assets should be served by the Go backend instead of Caddy, so can just forward all requests to the backend.

root * /speedtest-go/assets and file_server are used to indicate the root directory of the site and allow it to access static files (js). After deleting them, the website seems to become a static page with no response.

This seems to be a problem with caddy's handling of URLs. I will try other reverse proxy solutions.

maddie commented 3 years ago

Here's an Nginx configuration FYR.

wsndshx commented 3 years ago

这是Nginx配置的FYR。

I found out that my configuration file was wrong.(orz)

I modified the configuration file to the following so that it can run normally.

speedtest.example.com {
    encode gzip
    reverse_proxy localhost:8989
}