FastDL

Downloads
1.1.0
2015
Stable

This PHP script for Linux and Windows Apache web servers is a FastDL download redirection service. When hosting steam game servers like CS, CSS, HL, HL2 or CSGO, you must enable FastDL to get decent download speed for resources, which can be very huge. And without, downloads are streamed in-game, thus the bandwidth being unnecessarily limited. The usual way is to put all bz2 archives of the files on a separate web URL and configure the path in game.cfg. This script however, redirects to the game directory itself, so you don't need to host the resource files separately. Additionally, security boundaries are held, especially for cfg/ and similar directories. For this, a whitelist is used to define directories allowed to be downloaded from.

Web server setup

You should bz2 all resource files and put them in the same directory as the map/sound/etc. files themselves. The script then redirects downloads to that directory. If you don't bz2 all of the files, the script still redirects to the uncompressed versions, which is still considerably faster than not using FastDL at all. This way, you avoid in-game file streaming completely.

"access.log" and "error.log" are created once the script is used. They serve as log files to check what files were downloaded and what files couldn't be found.

Remember to set up config.php accordingly to your game server. The variable "AllowedDirectories" serves as a security boundary to filter directories that can be accessed by the script from inaccessible directories. Never allow access to the cfg directory! Allowed directories should be explicitly defined directories that contain downloadable game content, not config files. Also, the web server needs to have read access to "BasePath".

Game server setup

After you're done setting up the web server with the FastDL script, configure your game.cfg. This can also be done prior to compressing the files.

sv_downloadurl "http://fastdl.example.com/css/27015_warserver"
sv_allowdownload 1
sv_allowupload 1

The sv_downloadurl is composed of following elements:

  • http://fastdl.example.com is the root URL of your web server
  • /css is the game. Allowed values are: "cs", "hl", "css", "hl2" or "csgo"
  • /27015_warserver is the path relative to your BasePath. Example: /home/steam/27015_warserver

Note: Additional games can be easily added. The code is held simple and is easy to extend.