CGI Script Service’s Web server allows you to serve plain old CGI scripts. This can be useful if you have some legacy or other scripts that you want to run as part of a node.


To configure a CGI Script Service, attach a dictionary element to a path in your Web transport Services :




Must be “cgi”.


The CGI base directory containing your scripts. The path can be absolute or relative to the node directory


The CGI script processor to use. This MUST be a fully qualified path to an executable.


Here is a complete example. First, create a new node

cd ~
mkdir test1
cd test1
crossbar init

Now activate CGI. Add the following snippet to configuration file at ~/test1/.crossbar./config.json

"myscripts": {
   "type": "cgi",
   "directory": "../cgi",
   "processor": "/usr/bin/python"

so your complete configuration file looks like

   "type": "web",
   "endpoint": {
      "type": "tcp",
      "port": 8080
   "paths": {
      "/": {
         "type": "static",
         "directory": ".."
      "ws": {
         "type": "websocket",
         "url": "ws://localhost:8080/ws"
      "myscripts": {
         "type": "cgi",
         "directory": "../cgi",
         "processor": "/usr/bin/python"

This configuration starts a Web Transport that includes a CGI processor on a subpath.

Now create an example CGI directory ~/test1/cgi and create a script file ~/test1/cgi/foo with this contents:

import sys

print("Content-Type: text/html\n\n")

print("""<!doctype html>
      <p>This is {} running {}</p>
""".format(sys.executable, __file__))

Then start

crossbar start

and open the page http://localhost:8080/myscripts/foo in your browser. You should see a hello from the Python CGI script.