Jump to content

Cloudflare CDN and Websockets


graphixmaker

Recommended Posts

horstepipe

I was too curious whether my problems would persist when changing to the pro plan, so I bought it and everything works fine with it (whithout using any page rules at all).

If there‘s a way to fix it without paying the 20 bucks/month I‘d really prefer coming back to free plan, but now it looks really like the free plan is limiting here.

Maybe you‘re an „older“ customer so there are some limitations active for me but not for you?

Edited by horstepipe
Link to comment
Share on other sites

Jdiesel

I was too curious whether my problems would persist when changing to the pro plan, so I bought it and everything works fine with it (whithout using any page rules at all).

If there‘s a way to fix it without paying the 20 bucks/month I‘d really prefer coming back to free plan, but now it looks really like the free plan is limiting here.

Maybe you‘re an „older“ customer so there are some limitations active for me but not for you?

 

I'm also on the free plan and don't experience any apparent web socket issues even with no page rules. I didn't read the entire thread but what is the issue exactly? Just the web sockets timing out?

Link to comment
Share on other sites

horstepipe

I'm also on the free plan and don't experience any apparent web socket issues even with no page rules. I didn't read the entire thread but what is the issue exactly? Just the web sockets timing out?

At the moment two problems:

- The websockets (but this seemed to work with pro plan)

- The ‚too many open files‘ error

Link to comment
Share on other sites

pir8radio

I was too curious whether my problems would persist when changing to the pro plan, so I bought it and everything works fine with it (whithout using any page rules at all).

If there‘s a way to fix it without paying the 20 bucks/month I‘d really prefer coming back to free plan, but now it looks really like the free plan is limiting here.

Maybe you‘re an „older“ customer so there are some limitations active for me but not for you?

 

cloudflare only limits concurrent websocket connections..  and its a really high number there is no way you are reaching it.

 

Mhh ok now I‘m getting

Too many open files

again.

How could this message come from?

 

show us a screen shot of what you are talking about.

Link to comment
Share on other sites

horstepipe

 

show us a screen shot of what you are talking about.

I can’t immediately because it is working at the moment.

When I try to open the Emby Server Webgui I‘m getting a blank white page, only written

Too many open files

in plain text in the top left corner

Link to comment
Share on other sites

horstepipe

Ok guys sorry again, the error comes from Emby not from cf. I thought it was coming from cf because as I tried to reach Emby via its origin IP it was working, but this was pure coincidence. The error seems to occur on library scan, so this is a topic for another thread (although I never saw it before).

Sorry again for all the bullshit I‘m spreading here :-)

 

So apart from that problem everything works fine for now. Let‘s take a look at the websockets when I‘m at the free plan again in 4 weeks.

 

Thank you very much

Edited by horstepipe
Link to comment
Share on other sites

graphixmaker

Problem is solved, there was simply a second A-record which shouldn’t have been there, sorry for wasting your time on that.

 

Now I‘m facing the same problem as the OP: The websockets don’t keep alive. I am not using nginx, only Cloudflare.

So for the guys who do not have this problem, could we please clarify if you’re on Cloudflare‘s free or pro Plan?

I could imagine that this is a limitation of the free plan.

 

@@graphixmaker

Have you already been able to solve the problem?

I have not solved the problem I'm having. I've redone my nginx conf to the previous examples but the issue persists. Everything else works perfectly but the web sockets die just over a minute into the connection.

Link to comment
Share on other sites

horstepipe

I have not solved the problem I'm having. I've redone my nginx conf to the previous examples but the issue persists. Everything else works perfectly but the web sockets die just over a minute into the connection.

That confirms my thesis that this is a limitation of the free plan, maybe for newer users only. Try the pro plan once to see if this resolves the problem for you, too.

Link to comment
Share on other sites

  • 2 weeks later...
horstepipe

Hey

It caught my eye that Emby dashboard sometimes shows me users from a Cloudflare IP, sometimes from their own. How does this happen? I thought through the reverse proxying of Cloudflare I‘d only see Cloudflare IPs from all users?

Link to comment
Share on other sites

pir8radio

Hey

It caught my eye that Emby dashboard sometimes shows me users from a Cloudflare IP, sometimes from their own. How does this happen? I thought through the reverse proxying of Cloudflare I‘d only see Cloudflare IPs from all users?

 

If you are using nginx and its setup correctly, you should always see two IP's   like 0.0.0.0, 1.1.1.1   the first one being your users IP and the second cloudflare.   That is the X-Forwarded-For header doing its job.  Each time a user passes through a reverse proxy, the proxy adds its ip to that list...     

  • Like 1
Link to comment
Share on other sites

horstepipe

If you are using nginx and its setup correctly, you should always see two IP's   like 0.0.0.0, 1.1.1.1   the first one being your users IP and the second cloudflare.   That is the X-Forwarded-For header doing its job.  Each time a user passes through a reverse proxy, the proxy adds its ip to that list...

 

Thanks, but I don’t use nginx or any other additional reverse proxy.

It looks like when a user signes on, Emby registeres a Cloudflare IP, and when a user signes off, Emby registeres his origin IP.

I hoped to be able to add a layer of privacy for my users with cf by obfuscating their IPs in my logs, but ok, no big deal.

Link to comment
Share on other sites

pir8radio

Thanks, but I don’t use nginx or any other additional reverse proxy.

It looks like when a user signes on, Emby registeres a Cloudflare IP, and when a user signes off, Emby registeres his origin IP.

I hoped to be able to add a layer of privacy for my users with cf by obfuscating their IPs in my logs, but ok, no big deal.

 

I would expect you to always see two IP's  the user, cloudflare.   You are not bypassing cloudflare for anything are you?  Like they hit the server with http first then are redirected to https on another ip or something?  But yes, it looks to be working as it normally does. 

 

5a07239188e6b_Capture.png

Link to comment
Share on other sites

  • 1 month later...
jscoys

Hello guys I’m a noob! Could someone explain me how to use cloud fare and setup everything like I would be 6 years old please? I bought a domain name on cheap, then I redirected to use cloud fare but now what I’m supposed to do on cloud fare side? Do I need a static IP?

 

 

Sent from my iPhone using Tapatalk

Link to comment
Share on other sites

pir8radio

Hello guys I’m a noob! Could someone explain me how to use cloud fare and setup everything like I would be 6 years old please? I bought a domain name on cheap, then I redirected to use cloud fare but now what I’m supposed to do on cloud fare side? Do I need a static IP?

 

 

Sent from my iPhone using Tapatalk

 

no you do not need a static IP see https://support.cloudflare.com/hc/en-us/articles/200168816-Does-Cloudflare-work-with-Dynamic-DNS-Can-I-update-my-DNS-records-remotely-

  • Like 1
Link to comment
Share on other sites

jscoys

Ok what I'm support to put in my CloudFare config? It tried to put my external IP Address and when I go to on the domain name it doesn't give me anything... How do you manage the 8096? Do I have to change it for 8080? My ISP is blocking the 80...

Link to comment
Share on other sites

dcrdev

Ok what I'm support to put in my CloudFare config? It tried to put my external IP Address and when I go to on the domain name it doesn't give me anything... How do you manage the 8096? Do I have to change it for 8080? My ISP is blocking the 80...

 

8096 isn't supported by CloudFlare, these are:

For requests made via HTTP:

80
8080
8880
2052
2082
2086
2095

For requests made via HTTPS:

443
2053
2083
2087
2096
8443

Be advised that CloudFlare doesn't support port redirection, so if your not using 80/443 - you'll always need to specify the port when connecting i.e. http://domain.com:8080, https://domain.com:8443. Equally the universal SSL feature in CloudFlare needs the origin server to also support SS, it won't upgrade http tp https.

Link to comment
Share on other sites

pir8radio

Ok what I'm support to put in my CloudFare config? It tried to put my external IP Address and when I go to on the domain name it doesn't give me anything... How do you manage the 8096? Do I have to change it for 8080? My ISP is blocking the 80...

 

Yes @@dcrdev is correct, you have to either setup your emby server to use standard HTTP/HTTPS ports (80/443) or use one of their supported ports he listed above. 

 

So you bought a domain, you changed your domain DNS servers to use the cloudflare DNS servers right?   You then create an A record in cloudflare that is your base domain name that points to your server IP address. 

 

5a3c5675517e6_Capture.png

 

You should then update your emby server to use port 80 and 443 ideally, and update the emby "External Domain" to show your domain name. 

If you don't want to change your emby local ports, you can port forward from 80/443 in your router to your existing local emby ports. 

 

Once you get that far let us know.  THere are a few cloudflare settings you should add that are emby specific, but those additional settings only improve the efficiency when using cloudflare. 

Link to comment
Share on other sites

jscoys

Hello thx for your advices!

 

It worked on yesterday, I opened the port 8080 redirecting to 8096 internally, had a A entry on Cloudflare "domain.com" pointing to my IP Adress, and a CNAME "WWW" pointing to my "domain.com" and today nothing's working. Cloudflare after a while is sending that my "domain.com" seems broken... On the domain name I just checked and the two Nameservers DNS from CloudFlare are there... I don't know! Do I have have to add more entries in CloudFlare than just an A and a CNAME?

Link to comment
Share on other sites

dcrdev

Hello thx for your advices!

 

It worked on yesterday, I opened the port 8080 redirecting to 8096 internally, had a A entry on Cloudflare "domain.com" pointing to my IP Adress, and a CNAME "WWW" pointing to my "domain.com" and today nothing's working. Cloudflare after a while is sending that my "domain.com" seems broken... On the domain name I just checked and the two Nameservers DNS from CloudFlare are there... I don't know! Do I have have to add more entries in CloudFlare than just an A and a CNAME?

 

You do not no - have you set up the dynamic dns I sent you the link to? Maybe your ip has changed...

Link to comment
Share on other sites

jscoys

No I checked my IP is exactly the same... I tried to remove/change nameservers, remove/add again the A and CNAME. Will wait for 24/48 hours and see. Thx for your help! Oh and if I put my ip:8080 it works...

Edited by jscoys
Link to comment
Share on other sites

jscoys

Ok it seems that I can’t go from internal network to domain.com, only from outside... do you why?

 

 

Sent from my iPhone using Tapatalk

Link to comment
Share on other sites

dcrdev

Ok it seems that I can’t go from internal network to domain.com, only from outside... do you why?

 

 

Sent from my iPhone using Tapatalk

 

 

Yep because you need nat loopback for that to work without your own dns server, some routers don't have this.

 

On Linux I use dnsmasq internally - not sure what's out there for Windows.

Link to comment
Share on other sites

jscoys

Hum it's fine... I don't have any interest to use mydomain from inside network, it will be faster anyway than going outside and then inside ;-)

 

Thx guys for your help!

  • Like 1
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...