Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

´Error: listen EADDRINUSE` when proxying https #14

Open
dbuezas opened this issue Sep 17, 2015 · 1 comment
Open

´Error: listen EADDRINUSE` when proxying https #14

dbuezas opened this issue Sep 17, 2015 · 1 comment

Comments

@dbuezas
Copy link

dbuezas commented Sep 17, 2015

My code looks like this:

fs = require 'fs'
path = require 'path'
findFreePort = require 'find-free-port'
filternet = require('filternet')
pem = require('pem')
PROXY_PORT = null
findFreePort 8090, (err, freePort) ->
  PROXY_PORT = freePort
  pem.createCertificate {days:1, selfSigned:true}, (err, keys)->
    return console.error err if err?
    key = path.resolve 'cert.key'
    crt = path.resolve 'cert.crt'
    fs.writeFileSync key, keys.serviceKey
    fs.writeFileSync crt, keys.certificate

    sslCerts = {
      '*': [key, crt]
    }
    myProxy = filternet.createProxyServer
      port: PROXY_PORT
      transSslPort: 8129
      sslCerts: sslCerts

    myProxy.on 'interceptResponseHeaders', (request_info, response_status_code, response_headers, callback) ->
      response_headers['Content-Security-Policy'] = ''
      callback response_status_code, response_headers

and I get the following exception:

Error: listen EADDRINUSE
  at errnoException (net.js:905:11)
  at Server._listen2 (net.js:1024:19)
  at listen (net.js:1065:10)
  at Server.listen (net.js:1133:5)
  at Object.module.exports.createProxyServer (/Users/davidbuezas/shopco/awesome-phantom-node/node_modules/filternet/lib/proxy.js:306:21) Error: listen EADDRINUSE
  at errnoException (net.js:905:11)
  at Server._listen2 (net.js:1024:19)
  at listen (net.js:1065:10)
  at Server.listen (net.js:1133:5)
  at Object.module.exports.createProxyServer (/Users/davidbuezas/shopco/awesome-phantom-node/node_modules/filternet/lib/proxy.js:306:21)

What am I doing wrong?

@dbuezas
Copy link
Author

dbuezas commented Oct 3, 2015

[PARTIALLY SOLVED]
by setting sslSockDir: somePath and deleting it before the second start.
But the proxy still doesn't work, the request gets rejected.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant