Help us improve your experience.

Let us know what you think.

Do you have time for a two-minute survey?

 
 

Setup and Initialization

Speedtest-enabled Test Agent

The Test Agent that is to be used for the Speedtest measurements must be accessible from the web client performing the Speedtest. In most cases, this means it must be accessible over the internet.

ALLOWED_ORIGINS Setting for REST API

In order for Speedtest to work, the Speedtest web page needs to be able to access the REST API. This means we must add the hostname at which the Speedtest web page is hosted to the ALLOWED_ORIGINS settings. If this is not done, the web browser will deny access to the REST API.

On your Control Center instance, open the file /etc/netrounds/restol.conf and add this setting:

where <hostname> is the Fully Qualified Domain Name (FQDN) where the Speedtest web page is hosted.

To learn about how the ALLOWED_ORIGINS setting works, read this article: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Access-Control-Allow-Origin

To understand the big picture regarding Cross-Origin Resource Sharing (CORS), you will find this article helpful: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS

Web Server Redirection from HTTPS to HTTP

Since the Speedtest feature in Paragon Active Assurance uses the unencrypted HTTP protocol for maximum performance, it is important that any web client loading the page uses http:// in the URL.

However, when linking to this page, or when the protocol http:// is omitted by the user in the address bar, web browsers will default to https://, which will cause issues with the Speedtest page.

For this reason, the built-in Speedtest feature in Paragon Active Assurance has a rewrite rule in the Apache config to redirect any https:// requests to http:// for the Speedtest page.

It is recommended that you add such a rewrite rule for your custom Speedtest web page as well. See the following subsections.

Hosting the Custom Speedtest Web Page with Control Center

If you are hosting your custom Speedtest web page on the same web server as Control Center, you can edit the file /etc/apache2/sites-available/netrounds-ssl.conf.

Below is the rewrite rule for the built-in Speedtest page:

So to add a similar rule for the example web page you would write:

Note:

If you upgrade Control Center to a new version, this file will be overwritten, so you will have to re-add this rule after the upgrade.

Hosting the Custom Speedtest Web Page on a Separate Web Server

If you are hosting the custom Speedtest web page on a different web server than the one where Control Center is hosted, please refer to your web server documentation on how to add a similar rewrite rule.

Including the Speedtest Library

The Speedtest library needs to be included and initialized in the HTML file. In example.html this is done as follows:

Explanations:

  • var account = 'dev' − Short name of the account in Paragon Active Assurance.
  • var apiUrl = 'https://<rest_hostname>/rest'Replace this with the URL to the Paragon Active Assurance REST API.
  • var workerScriptPath = 'static/js/SpeedtestWorker.js' − Path where the worker script will be accessible.

Initializing Speedtest

In the file static/js/script.js, initSpeedtest sets up the callback functions, which will handle the Speedtest responses.

The argument for each speedtest. function should be a callback function which handles the data sent by SpeedtestLib.

  • speedtest.setSnapshotResponse(resultSpeed) − partial results for the upload/download part of the test; sent during the test run
  • speedtest.setResultResponse(resultDelay) − partial results for the TCP/ICMP Ping part of the test; sent during the test run
  • speedtest.setFailureResponse(failureHandler) − sending the report to Control Center failed
  • speedtest.setSuccessResponse(successHandler) − sending the report to Control Center succeeded
  • speedtest.getServers(setServerDropdown) − list of available servers was fetched
  • speedtest.getCategories(setCategoryDropdown) − list of available Speedtest categories was fetched

For example, the setServerDropdown callback function populates the available servers in the user interface:

Here, serverList is provided by SpeedtestLib.

For the other callback functions, please refer to static/js/script.js.