Newbie questions

#1

Hi,

  1. Is it possible to host your static assets (i.e. index.html) on the usual port 80, AND have WAMP websockets running with the url subpath ‘ws’ like in example Json config files at http://crossbar.io/docs/Web-Transports-and-Services/
    I’m able to get apps running fine under the example port 8080, but when i change the port number, it doesn’t seem to work. (e.g. http://999.999.99.99:8080/MyApp1 and http://999.999.99.99:8080/MyApp2 works, but http://999.999.99.99:80/MyApp3 nor http://999.999.99.99/MyApp4 doesn’t)
    Ideally I would like my single-page app server on the usual port 80, and then the normal WAMP communication via websockets. Is this possible?

  2. Also, I need to make my data over the wire secure (SSL). I’m really at a loss on how to do this. I’ve read the docs, but it might be a little over my head (read: Noob guide needed) If I get some help, I would be happy to contribute a doc of some kind to show others.

Cheers,
Brad.

0 Likes

#2

Hi Brad,

For SSL issues, check out my blog post here: http://www.pynut.com/?p=105 if you aren’t on Linux or unfamiliar with running OpenSSL commands you might have to read some of the links there too to find the commands you need to strip the password off your key file and configure any certs you have to .pem.

It addresses OpenSSL requirements to configure certs correctly. As far as config goes, I’m a little unclear as to what you are attempting to do. From what you wrote, it looks like you are trying to add two endpoints to the Crossbar config? If this is true, then it is easily doable, see config below (you can see SSL certs configured below as well, keep in mind this is for a config supporting Python 3 GUEST workers, native or container workers maybe different). In the config I configure one endpoint by URL and one with the endpoint JSON tree. What you see below is done to allow for a “loopback” interface on the same server that is running the WAMP router to allow for authentication traffic through WAMP-CRA in a separate python 3 guest worker to not have to go out to the internet to be routed to come back in (since I am using an SSL cert on the site frontend and for every other guest worker except the authentication python guest worker for secure traffic for anything Internet bound).

I know this is probably overload, but happy to answer other questions if I can, this is a great project!

Dave

"transports": [
   {
      "id": "loopback",
      "type": "websocket",
      "endpoint": {
         "type": "tcp",
         "port": 9000,
         "interface": "127.0.0.1"
      },
      "auth": {
         "wampcra": {
            "type": "static",
            "users": {
               "authenUser": {
                  "secret": "some secret generated through autobahn",
                  "role": "authenticator",
                  "salt": "salt123",
                  "iterations": 100,
                  "keylen": 16
               }
            }
         }
      },
      "debug": false,
      "options": {
         "compression": {
            "deflate": {
               "request_no_context_takeover": false,
               "request_max_window_bits": 11,
               "no_context_takeover": false,
               "max_window_bits": 11,
               "memory_level": 4
            }
         }
      }
   },
   {
      "id": "web",
      "type": "web",
      "endpoint": {
         "type": "tcp",
         "port": 8015,
         "tls": {
            "key": "private.pem",
            "certificate": "public.pem"
         }
      },
      "paths": {
         "/": {
            "type": "static",
            "directory": "../frontend"
         },
         "ws": {
            "type": "websocket",
            "url": "wss://yourwebsite.com:8015/ws",
            "auth": {
               "wampcra": {
                  "type": "dynamic",
                  "authenticator": "com.yourwebsite.authenticate"
               }
            },
            "debug": false,
            "options": {
               "compression": {
                  "deflate": {
                     "request_no_context_takeover": false,
                     "request_max_window_bits": 11,
                     "no_context_takeover": false,
                     "max_window_bits": 11,
                     "memory_level": 4
                  }
               }
            }
         }
      }
   }
]
0 Likes