5 months ago
Hi guys,
I've started recently my coding journey and I'm deploying a nats server with the following configuration :
docker file :FROM nats:latest COPY nats-server.conf /etc/nats/nats-server.conf EXPOSE 4222 6222 8222 9222 CMD ["--config", "/etc/nats/nats-server.conf"]
conf file:
`port: 4222
http_port: 8222
websocket {
port: 9222
notls: false sameorigin: false
allowedorigins: [ "https://MYDOMAIN.com", "https://MYDOMAIN.com" ] compression: true handshaketimeout: "5s"
}
debug: true
trace: true
logtime: true`
If I set the notls: to true, the nats server is working correctly but it says that TLS isn't activated and shouldn't be used in production. If I set the notls: to false, it says that nats-server: websocket requires TLS configuration
Do you guys have an idea how to solve it ?
I though that I could set no_tls : true if Railway handles SSL?
Thanl you for reading and help 🙂
0 Replies
5 months ago
Railway does handle SSL for you
I can't connect to NATS. I tried to remove the allowed origins in the docker file but it doesnt work :
Nats logs :Using configuration file: /etc/nats/nats-server.conf [1] 2024/12/14 21:44:32.392731 [DBG] Created system account: "$SYS" [1] 2024/12/14 21:44:32.393451 [INF] Starting http monitor on 0.0.0.0:8222 [1] 2024/12/14 21:44:32.393564 [INF] Listening for websocket clients on ws://0.0.0.0:9222 [1] 2024/12/14 21:44:32.393572 [WRN] Websocket not configured with TLS. DO NOT USE IN PRODUCTION! [1] 2024/12/14 21:44:32.393575 [DBG] Get non local IPs for "0.0.0.0" [1] 2024/12/14 21:44:32.393752 [DBG] ip=REDACTED [1] 2024/12/14 21:44:32.393762 [DBG] ip=REDACTED [1] 2024/12/14 21:44:32.393809 [INF] Listening for client connections on 0.0.0.0:4222 [1] 2024/12/14 21:44:32.393815 [DBG] Get non local IPs for "0.0.0.0" [1] 2024/12/14 21:44:32.393909 [DBG] ip=10.250.29.95 [1] 2024/12/14 21:44:32.393917 [DBG] ip=REDACTED [1] 2024/12/14 21:44:32.393929 [INF] Server is ready
From my terminal:npx wscat -c ws://PUBLIC-BACKEND-URL:9222 connect ETIMEDOUT
npx wscat -c wss://PUBLIC-BACKEND-URL:9222 connect ETIMEDOUT
5 months ago
the service does not have a public domain?