-
Notifications
You must be signed in to change notification settings - Fork 339
HTTPS guide? #135
Comments
It's really easy and there are plenty of articles on it online: |
Well, yes, I found a few like those... But then how do I change that to incorporate the port 6060 server, do I move the static files to /var/www or do I change the path, ... It's mostly how to configure the nginx together with Hack.Chat I'm struggling with I guess. But thanks for your help already! |
look at "how to proxy websockets using nginx" that will give you a client <--encrypted--> nginx <--local-->hack.chat connection. E.G this article looks good: https://www.nginx.com/blog/websocket-nginx/ (you can skip the npm and javascript part as you use hack.chat for that. something like this should work (you probably want to add ssl directives though)
then you need to change these lines: https://github.com/AndrewBelt/hack.chat/blob/master/client/client.js#L61-L68 to something like ws = new WebSocket('wss://' + document.domain + ':6061') |
this is what I have for a hc fork
|
Okay, this helped! I've managed to generate Let's Encrypt keys, edited your example file, etc. I ran into a snag where another app was using the 8080 port, but fixed that already. But now I'm afraid I'm stuck again, getting the error 502 Bad Gateway from nginx. Also, this might be relevant, HC is still working on port 80 and not redirecting me to HTTPS. Any ideas where to start looking? |
did you copy over this part
that's the part that makes the redirect |
Found it, I was starting HC on port 80 and obviously nginx on port 80, so letting HC start on port 8080 fixed that error. I think I'm at my final issue. Everything works now, except that my console throws an error that he either can't reach URL:6060 (which I guess makes sense, since nginx is rerouting /chat-ws there) or that URL/chat-ws throws a 404. By now, I guessed I should edit this line: https://github.com/AndrewBelt/hack.chat/blob/master/client/client.js#L67
But neither option is really working out. I'm going to guess I'm all good after that, so many thanks for your help already! EDIT: Ugh, nevermind, noticed now your file says chatws instead of the chat-ws HC used. Dumb on my part. Thanks for helping me out on this! |
well on HC it's /chat-ws but on my nginx file it's /chatws that may be why you're struggling |
Hi everyone, Thanks! nginx.conf:
I receive this error:
with this client.js line change: if I make client.js read: Then the page just sits there and fails. Not sure how to proceed? |
@newdayhost See this for the error #136 |
I was able to get it to work by setting:
in package.json and re-running Thanks @raf924 ! |
@raf924 if i use you config i get error 400 on wss.... |
Because the path is different on my config. It should be /chat-ws |
@raf924 i changed that and checked everything double, i've also tried to change ws dependency from 3.0.0 to 1.1.1 and nothing change |
when you downgrade a dependency, you should remove its folder from node_modules or delete the whole node_modules folder and start npm install again |
i know, i've done everything i know, but it still have problems..... |
you didn't modify the code? |
dont know how, but using upstream with nginx reverse proxy it worked, thanks for support ;)
|
Weird you shouldn't have had to do that but great. |
I wanted to try and host one of those on a Raspberry Pi. I got everything to work as intended, but now I'm pretty clueless how to make it work over SSL. Has anyone managed to get this to work with Let's Encrypt? And if so... Any clues on how to do it?
I've read bits about hosting the static files on Apache of nginx, but I have no idea how to even get started on that. Any help would be appreciated!
The text was updated successfully, but these errors were encountered: