Coder Social home page Coder Social logo

Comments (10)

cazala avatar cazala commented on July 1, 2024

are you creating an https server and passing it to the proxy like this? https://github.com/cazala/coin-hive-stratum#how-can-i-make-my-proxy-work-with-wss

from coin-hive-stratum.

thawwed avatar thawwed commented on July 1, 2024

I did not do that. How do I do that? Do I add that to my javascript or is this done elsewhere? By the way, I am using apache, will this conflict with apache?

from coin-hive-stratum.

cazala avatar cazala commented on July 1, 2024

save this as your proxy.js

// Create your proxy
const createProxy = require("coin-hive-stratum");
const proxy = createProxy({
  host: "la01.supportxmr.com",
  port: 3333
});


// Create an HTTPS server
const fs = require("fs");
const server = require("https").createServer({
  key: fs.readFileSync("./server.key"),
  cert: fs.readFileSync("./server.crt")
});
server.listen(8892);

// Pass your HTTPS server to the proxy
proxy.listen({
  server: server
});

and just run it like node proxy, you should be able to access it from wss://localhost:8892.

you will need those server.key and server.crt certificates in order to work. you can generate self-signed certificates by running this:

openssl x509 -req -sha256 -days 365 -in server.csr -signkey server.key -out server.crt

but those certificates won't be trusted by your browser, so you will get an alert, so you will have to add them to your trusted certificates manually

I have no idea about Apache tho, it might need some extra configuration.

from coin-hive-stratum.

 avatar commented on July 1, 2024

i got it to run within http and just tried this for https.
i did not configure https for my server since i want to keep flexible ssl on cloudflare.
i copied a valid key and crt in the same folder my new proxy.js is inside.

Now i get a "Error: Cannot find module 'coin-hive-stratum'
" error when i try to run it with node proxy (also tried as root).
can you help me out?

from coin-hive-stratum.

thawwed avatar thawwed commented on July 1, 2024

from coin-hive-stratum.

cazala avatar cazala commented on July 1, 2024

do
npm init --yes && npm i --save coin-hive-stratum
in the same dir where you have your proxy.js file

from coin-hive-stratum.

 avatar commented on July 1, 2024

Now i have a new error
"Error: error:0906D06C:PEM routines:PEM_read_bio:no start line
"

Is this below here correct? proxy.js and key,crt and pem file in the same folder.
// Create an HTTPS server
const server = require("https").createServer({
key: "mysite.key",
cert: "mysite.crt"
});

from coin-hive-stratum.

cazala avatar cazala commented on July 1, 2024

from coin-hive-stratum.

 avatar commented on July 1, 2024

I worked around it:
I disabled ssl for my domain:port in a page rule in cloudflare.
Now it works :)

from coin-hive-stratum.

cazala avatar cazala commented on July 1, 2024

Nice :D !

there was a line missing in the code from my comment above:

const fs = require("fs");

I just edited the comment and added it to the readme

from coin-hive-stratum.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.