Question

I can't seem to get node.js (v0.8.2) to work with spdy (v1.2.1). Here's my code in coffeescript because it's cool:

spdy = require 'spdy'
fs = require 'fs'

DEFAULT_PORT = 8000

DEFAULT_SERVER_OPTIONS =
  key: fs.readFileSync(__dirname + '/keys/privatekey.pem')
  cert: fs.readFileSync(__dirname + '/keys/certificate.pem')
  ca: fs.readFileSync(__dirname + '/keys/certrequest.csr') 

spdy.createServer DEFAULT_SERVER_OPTIONS, (request, response) ->
    console.log 'request made...'
    response.writeHead 200
    response.write 'goodbye cruel world'
    response.end()
.listen DEFAULT_PORT
console.log 'Server running on ' + DEFAULT_PORT

I see "Server running on 8000", but when trying to connect to 127.0.0.1:8000 in Chrome, I get nothing, and "request made..." never goes off.

Thanks so much guys!!

Was it helpful?

Solution

Make sure you're accessing it via HTTPS. Aka: https://127.0.0.1:8000/ (works fine here)

SPDY is negotiated over SSL NPN, which means your server is only accessible via HTTPS protocol.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top