ably-js icon indicating copy to clipboard operation
ably-js copied to clipboard

Documentation about CSP for websocket

Open kyeshmz opened this issue 1 year ago • 1 comments

Hi, I am building a electron game that uses Ably Realtime. I need to add all the CSP headers for security reasons. It seems that it is hitting variations of wss://realtime.ably.io, such as a.ably.io , b., c., etc. Is there a list of CSP connect-src that I need to enable somewhere?

Related, but not the same https://faqs.ably.com/csp-rejection-to-internet-uptxt

┆Issue is synchronized with this Jira Task by Unito

kyeshmz avatar Jun 26 '24 09:06 kyeshmz

Hi @kyeshmz !

For websocket connections library will attempt the next hosts by default: default is wss://realtime.ably.io, and fallback hosts in case of an error: wss://a.ably-realtime.com, wss://b.ably-realtime.com, wss://c.ably-realtime.com, wss://d.ably-realtime.com, wss://e.ably-realtime.com

For HTTP requests library will attempt the next hosts by default: default is https://rest.ably.io, and fallback hosts in case of an error: https://a.ably-realtime.com, https://b.ably-realtime.com, https://c.ably-realtime.com, https://d.ably-realtime.com, https://e.ably-realtime.com

And you should also add https://internet-up.ably-realtime.com for internet connection checks

VeskeR avatar Jun 27 '24 20:06 VeskeR

@VeskeR Hi, Thank you for the prompt reply! I think this is everything that I wanted to know! Hopefully documentation can be added about this somewhere.

kyeshmz avatar Jul 02 '24 23:07 kyeshmz

Hey @kyeshmz ! Hope you're doing well! I forgot one more endpoint that is used by ably-js SDK: wss://ws-up.ably-realtime.com/ - used to check if websocket connectivity is available.

The official documentation for domains to whitelist is available here: https://faqs.ably.com/if-i-need-to-whitelist-ablys-servers-from-a-firewall-which-ports-ips-and/or-domains-should-i-add, with more in depth details too. We will think about adding a link or some mention of this to the ably-js repo README too.

VeskeR avatar Jul 09 '24 16:07 VeskeR

How do you differ from FAQ and documentation? Just seems like something that could be added in the docs website rather than for FAQ.

kyeshmz avatar Jul 11 '24 00:07 kyeshmz