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

SSL / TLS #667

Open
codenamegary opened this issue Aug 4, 2023 · 7 comments
Open

SSL / TLS #667

codenamegary opened this issue Aug 4, 2023 · 7 comments
Assignees

Comments

@codenamegary
Copy link

codenamegary commented Aug 4, 2023

The problem I am facing
I have this up and running and it works great! I'm facing challenges when serving up something over SSL, and then trying to connect to wss:// in production. Browsers throw mixed content errors and it doesn't work.

The solution I would like

const server = Server.configure({
  port: 3333,
  address: address(),
  async onConnect(data) {
    console.log(Date.now() + ' connected!')
  },
  extensions: [
    new SQLite({
      database: 'db.sqlite',
    })
  ],
  // New stuff here
  ssl: {
    cert: "/path/to/certificate.pem",
    keyPath: "/path/to/key.pem"
  }
})

And essentially just follow along the ws example from there.

Alternatives I have considered
I have tried every AWS load balancer config and an nginx proxy but nothing seems to work.

Additional context
I think I have a handle on how this could work, happy to put together a pull request if it's desireable.

@codenamegary
Copy link
Author

I managed to get this working but I'm not proud of my methods. Used a combination of local-ssl-proxy and certbot. 😂😭

@jimmiebtlr
Copy link

Not sure about the SSL flags, but to be sure, you meant 'wss://' not 'ws://' for secure websockets correct?

@codenamegary
Copy link
Author

codenamegary commented Aug 4, 2023

Yep that's right. Updated.

@markcipolla
Copy link

@codenamegary Mind sharing how you created a workaround? I'm having the same issue

@codenamegary
Copy link
Author

codenamegary commented Nov 22, 2023

@markcipolla - Sorry for the super late response. My workaround was just to use this.

https://github.com/cameronhunter/local-ssl-proxy

I used certbot to generate a certificate then just run local-ssl-proxy accordingly to forward from 443 to whatever port my HocusPocus is running on.

@csaeth
Copy link

csaeth commented Nov 28, 2023

Hi @codenamegary,

Thanks for sharing your solution. Are you using HocuspocusProvider or a custom Provider (y-websocket) to connect to the HocusPocus Server via local-ssl-proxy?

Cheers!

@codenamegary
Copy link
Author

I'm using HocuspocusProvider.

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

No branches or pull requests

5 participants