Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SERVER_NAME and url_for() - why should we use url_for() ? #31

Open
flipmcf opened this issue Sep 26, 2022 · 1 comment
Open

SERVER_NAME and url_for() - why should we use url_for() ? #31

flipmcf opened this issue Sep 26, 2022 · 1 comment
Labels
question Further information is requested

Comments

@flipmcf
Copy link
Owner

flipmcf commented Sep 26, 2022

flask's SERVER_NAME setting is bothersome.

I stopped using url_for() - maybe for good?

In a load-balancing and CDN situation where the instance is a different hostname or responding to a different hostname than the actual published URL, setting SERVER_NAME to the CDN hostname might break routing - flask replies with 404 on every endpoint route because the SERVER_NAME doesn't match the host header it gets from 'upstream'.

But not setting SERVER_NAME makes flask guess about the protocol scheme and hostname and you might get some weird host in your m3u8 that points to a local instance that is not publically accessable. like http://172.31.21.141/i/path/to/file.mp4/index_0_av.m3u8 and the streams fail to play.

so, look carefully at casterpak.py 'get_base_url' and decide what's best. right now we don't tell flask what the server name is and manually construct the base url without using 'url_for()' and maybe that's ok. I don't know.

@flipmcf flipmcf added the question Further information is requested label Sep 26, 2022
@flipmcf
Copy link
Owner Author

flipmcf commented Sep 26, 2022

12c9e71 is where this mess begins.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

1 participant