speedtest icon indicating copy to clipboard operation
speedtest copied to clipboard

Support for plain nginx test backend

Open margau opened this issue 5 years ago • 2 comments

Description

Providing an nginx configuration to act as basic test backend

Why it should be implemented

No further service needed, which allows a small-footprint test endpoint on "light" systems. For my side, I'm planning to deploy this on routers at different locations. Nginx is available, but I wanna to avoid setting up separate services trough the network

Implementation suggestions

Prototype with the provided nginx configuration is available under https://speedtest.margau.net (IPv6 only)

The only thing missing is the upload test, which i unfortunately not got working by now.

server {
  listen [::]:443 ssl http2 default_server ipv6only=off;

[...]
    location /speedtest/empty {
      client_max_body_size 256M;
      add_header Access-Control-Allow-Origin "*";
      add_header Access-Control-Allow-Methods "GET, POST";
      add_header Access-Control-Allow-Headers "Content-Encoding, Content-Type";
      add_header Cache-Control "no-store, no-cache, must-revalidate, max-age=0, s-maxage=0'";
      add_header Cache-Control "post-check=0, pre-check=0";
      add_header Pragma no-cache;
      return 200;
    }
    location /speedtest/dl {
      add_header Access-Control-Allow-Origin "*";
      add_header Access-Control-Allow-Methods "GET, POST";
      add_header Access-Control-Allow-Headers "Content-Encoding, Content-Type";
      alias /var/www/edge.as213204.net/html/test/100m.bin;
    }
    location /speedtest/ip {
      add_header Access-Control-Allow-Origin "*";
      add_header Access-Control-Allow-Methods "GET, POST";
      add_header Access-Control-Allow-Headers "Content-Encoding, Content-Type";
      types { } default_type "application/json; charset=utf-8";
      return 200 '
        {"processedString":"$remote_addr","rawIspInfo":""}
      ';
    }

[...]
}

If I manage to solve the upload test issue, I'll happily provide an PR.

margau avatar Nov 11 '20 20:11 margau

Thank you. If you can get it working properly I'll add it to the wiki

adolfintel avatar Nov 12 '20 07:11 adolfintel

I see that the problem with the download has already been solved, judging by the test https://speedtest.margau.net could you please provide an example configuration for nginx?

Draco-Zero avatar Apr 03 '22 11:04 Draco-Zero