LLHLS chunklist requests return 401 Unauthorized (“Invalid session_key”) behind Nginx reverse proxy with AdmissionWebhooks #1822
-
|
Hi folks, I’m running OvenMediaEngine (v0.12.6) in Docker behind an nginx reverse proxy (with SSL) and using AdmissionWebhooks for access control. My LLHLS streams work for the master playlist but every chunklist request is immediately rejected with 401 Unauthorized / Invalid session_key. I’ve pasted my configuration and logs below—any pointers on what I’m missing would be hugely appreciated!
`upstream om_llhls { server { }
Thank you in advance for any guidance! |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments
-
|
Great timing on this - just the other day I started trying to move my backend from Apache/PHP to NGINX/PHP-FPM and encountered this exact issue (although with the master branch, not 0.12.6). I've tried a bunch of config options and the best I can get back is the same invalid session_key error you are seeing. Based on this having worked perfectly with Apache for years, I can answer some of your questions anecdotally:
This was not required in my previous setup. That is, the chunklist calls were direct, no webhook (I imagine that's thanks to use of the session_key)
OriginMode does not need to be set unless you are proxying to Edge servers in which case, I believe the directive is to enable OriginMode.
In Apache it was quite simple, literally two lines: I suspect that the session key is reaching OME fine (since it is printing out the proper request URL in the logs), but there is some other validation problem.
Based on the above you'll also see that SSL was handled at the web server / proxy level and not enabled in OME. |
Beta Was this translation helpful? Give feedback.
-
|
If there is a cache server behind OME, AdmissionWebhooks will not work as expected. In that case, authentication should be done by the cache server. Specifically,
The reason you are getting a 401 error may be because you are requesting with an expired session key. Unlike a normal player, if nginx requests the master playlist and immediately closes the connection (this causes the session to expire), and then requests chunklist with a new connection, that could happen. Anyway, I don't think too deeply about this. As I said above, when using Nginx as an edge, set OriginMode to true. And authentication should be done at the nginx side. Just like other commercial HLS services leave all authentication functions to CloudFront when using CloudFront as an edge. 0.12.6 is too old. It's too hard to check how OME worked in 0.12.6. Please use the latest version. |
Beta Was this translation helpful? Give feedback.
-
|
Thanks for the pointer about session‑binding. We ended up fixing it by: With those two changes, our chunklists (chunklist_*.m3u8?session=…) now return 200 OK instead of 401, and playback is good. `upstream om_llhls { server { }` With this in place, AdmissionWebhooks issues the session on the playlist request, and all chunklist/segment requests succeed on the same connection. |
Beta Was this translation helpful? Give feedback.
If there is a cache server behind OME, AdmissionWebhooks will not work as expected. In that case, authentication should be done by the cache server.
Specifically,