Jump to content

Cloudflare & other Proxy support


pir8radio

Recommended Posts

pir8radio

I know this request wont get much traction because only a hand full of people are using/would want to use cloudflare.    

 

     But I would like to request a feature that allows you to set a streaming domain name in emby, so that any requests for Audio or Video files get directed to this second domain name.  It would be the same server but a different request path just for the streaming files within the master/main playlists. 

 

For example normal emby server address embyserver.com   if any client plays content i want the content to be requested from stream.embyserver.com.    This is handy for cloudflare because you can benefit from all of the CSS, JS, HTML, and image caching on their edge servers, offloading all of that content from your local emby server while keeping the actual streams off of cloudflares reverse proxy by bypassing the stream.embyserver.com domain within cloudflare.

 

 

58867c605068d_Untitled.png

 

 

If this is not something you would consider, who does most of the JavaScript programming within emby? Particularly the hls.min.js or whatever is building the playlists for transcoded files, maybe i can get a hand making some changes on my end for testing..

Edited by pir8radio
Link to comment
Share on other sites

funwithmedia

It sounds like you'd want to route everything to Cloudflare, except for video / audio files of all kinds (including things like .mpeg, mkv, etc.), so not just limited to VIDEO_TS folder rips. Correct?

 

I've not gotten into accessing Emby remotely, but as a fellow user this is certainly an interesting idea. :)

Link to comment
Share on other sites

pir8radio

It sounds like you'd want to route everything to Cloudflare, except for video / audio files of all kinds (including things like .mpeg, mkv, etc.), so not just limited to VIDEO_TS folder rips. Correct?

 

I've not gotten into accessing Emby remotely, but as a fellow user this is certainly an interesting idea. :)

 

That is correct.  Anything coming from the /emby/VIDEO/ or emby/AUDIO paths would be nice.   edited my original post.

Edited by pir8radio
Link to comment
Share on other sites

pir8radio

@@ebr can you have someone delete this entire thread....  I just found cloudflare supports redirects out of the box,  and i got this working...  

Link to comment
Share on other sites

funwithmedia

Actually, rather than delete the thread, why don't you provide some direction (even just a link or two) for others, in case someone else wants to explore this at some point? :)

  • Like 1
Link to comment
Share on other sites

Yeah, I was going to say - won't CF support this already?

 

So, do complete this by posting how to set it up and then we can mark it solved.  Thanks.

Link to comment
Share on other sites

pir8radio

You just need to do a rule that redirects all traffic to a specific url, however if you do not pay for additional "Page Rules" you will be forced to have your "stream.yourdomain.com" path run in either https or http not dynamically match what your clients are using.

 

Video stream redirect:

Page rule url:  *yourdomain.com/emby/videos/*

Forwarding url: https://stream.yourdomain.com/emby/videos/$2

Status code: 302 - Temporary Redirect    (don't make it permanent, if you ever shut off CF you will have headaches)

 

Audio stream redirect:

Page rule url:  *yourdomain.com/emby/audio/*

Forwarding url: https://stream.yourdomain.com/emby/audio/$2

Status code: 302 - Temporary Redirect    (don't make it permanent, if you ever shut off CF you will have headaches)

 

Add a CURL to your CF setup for stream.yourdomain.com and click the orange cloud so it turns grey, bypassing all proxy/caching that CF does. 

 

 

 

If you pay for additional page rules you can create 4 rules two for http, and two for https so you are not forced to one or the other. 

those rules would look something like below, except you will have 4 rules: 

 

HTTP only rule:

Page rule url:  http://*yourdomain.com/emby/videos/*

Forwarding url: http://stream.yourdomain.com/emby/videos/$2

Status code: 302 - Temporary Redirect    (don't make it permanent, if you ever shut off CF you will have headaches)

 

HTTPS only rule:

Page rule url:  https://*yourdomain.com/emby/videos/*

Forwarding url: https://stream.yourdomain.com/emby/videos/$2

Status code: 302 - Temporary Redirect    (don't make it permanent, if you ever shut off CF you will have headaches)

 
and the same for the /audio/ path.
Edited by pir8radio
Link to comment
Share on other sites

pir8radio

@@ebr      Well the above works for web based, and iphone apps, but it looks like fireTv does not handle 302 redirects?  Is that a true statement?  

Link to comment
Share on other sites

pir8radio

so i need help from one of the javasript gurus to help me insert https://stream.mydomain.com into hls.min.js  , so that the master playlist is built with an absolute url (my specific one) vs the relative one.   Please.

 

I assume its near buildAbsoluteURL somewhere...  but It will take me forever to figure it out on my own.lol

Edited by pir8radio
Link to comment
Share on other sites

Happy2Play

no one willing to help me hard code my stream url into hls.min.js?  :(

 

Visibility for a request like this is going to limited in the Feature request forum.  And additionally something that has to be applied with every release.

Link to comment
Share on other sites

pir8radio

I was just looking for help to point me where to edit my copy. nginx can dynamically rewrite as it sends to the client so versions can change.  But i guess this is more of an issue with emby not being able to handle 302 redirects, so I'll post that as an issue. thx

Link to comment
Share on other sites

pir8radio

Just to update this thread, there may or may not be an issue with two emby clients handling 302 redirects, so the above suggestion to bypass CloudFlare when sending a stream is how you would want to do this, except it breaks playback on Roku and FireTv/Android (which the team is looking into) due to the redirect. 

Link to comment
Share on other sites

  • 10 months later...
Guest plexman

How is the status of this? I've tested on Chromecast and happens the same as Roku and FireTV/Android, it is not able to handle 302 redirects.

Link to comment
Share on other sites

pir8radio

How is the status of this? I've tested on Chromecast and happens the same as Roku and FireTV/Android, it is not able to handle 302 redirects.

 

They were looking into it to see if those devices did not support 302 redirects,  they were not looking into it to fix it, thought that would be nice.

Edited by pir8radio
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...