Response with code 403 to specific client?

I’m using onHTTPStreamerRequest , to inspect http streaming requests, is there any way to send response with forbiden http code 403 , if some conditions are met??

Yes, you can reject HTTP streaming requests from within the onHTTPStreamerRequest method based on your custom logic.

You don’t have the ability to modify the incoming request, but if you decide to reject it (for example, due to authentication failure or invalid parameters), you can do so using the httpSession which is available in the onHTTPStreamerRequest method signature.

httpSession.rejectSession();     // Sends a 403 Forbidden response to the client
httpSession.setDeleteSession();  // Immediately removes the session from the app

The first call rejects the session, sending a 403 response to the player, and the second call removes the session from the application immediately, instead of waiting for it to time out.

This is the recommended way to block unwanted streaming sessions based on your conditions.

1 Like