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

RTC: Ensure private network requests are made from secure contexts #2787

Closed
winlinvip opened this issue Dec 12, 2021 · 0 comments
Closed

RTC: Ensure private network requests are made from secure contexts #2787

winlinvip opened this issue Dec 12, 2021 · 0 comments
Assignees
Labels
Discussion Discussion or questions. TransByAI Translated by AI/GPT. WebRTC WebRTC, RTC2RTMP or RTMP2RTC. Won't fix We won't fix it.
Milestone

Comments

@winlinvip
Copy link
Member

winlinvip commented Dec 12, 2021

Today I discovered that Chrome updated its security policy in July 2021, which caused the HTTPS player on the official website to be unable to play the SRS stream on the local network. Of course, this does not mean that it cannot be used at all. I will list which ones are working properly and which ones have issues (assuming your SRS local network IP is 192.168.11.172):

Note: The mentioned "play HTTP API" refers to the API for WebRTC streams, which is an HTTP API. The transmission of the streams still uses UDP.

The last point is about playing SRS streams from an internal network using the official HTTP player. This issue is related to the security policy update made by Chrome a few months ago. If you open the console, you will see the following error message.

Ensure private network requests are made from secure contexts

A site requested a resource from a network that it could only access because of its users' privileged 
network position. These requests expose devices and servers to the internet, increasing the risk of a 
cross-site request forgery (CSRF) 
attack, and/or information leakage.

To mitigate these risks, Chrome deprecates requests to non-public subresources when initiated from 
non-secure contexts, and will start blocking them in Chrome 92 (July 2021).

To fix this issue, migrate the website that needs to access local resources to HTTPS. If the target resource 
is not served on localhost, it must also be served on HTTPS to avoid mixed-content issues.

Administrators can make use of the InsecurePrivateNetworkRequestsAllowed and 
InsecurePrivateNetworkRequestsAllowedForUrls enterprise policies to temporarily disable this restriction 
on all or certain websites.


1 request
Request	Status	Resource Address	Initiator Address	Initiator Context
play/	blocked	Private	Public	insecure

Learn more: CORS for private networks (RFC1918)

I have tried adding parameters to the page, but it didn't work.

    <meta name="referrer" content="origin">

Here is an alternative workaround: If you are only developing, debugging, and learning, you can follow the method taught by Darren, a teacher at Zero Sound Academy. Simply disable HTTPS and all security policies when starting Chrome, which works well.

If it is for online use, it is better to stick to HTTPS honestly.

References:

TRANS_BY_GPT3

@winlinvip winlinvip added WebRTC WebRTC, RTC2RTMP or RTMP2RTC. Discussion Discussion or questions. Won't fix We won't fix it. labels Dec 12, 2021
@winlinvip winlinvip added this to the 4.0 milestone Dec 12, 2021
@winlinvip winlinvip self-assigned this Dec 12, 2021
@winlinvip winlinvip added the TransByAI Translated by AI/GPT. label Jul 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Discussion Discussion or questions. TransByAI Translated by AI/GPT. WebRTC WebRTC, RTC2RTMP or RTMP2RTC. Won't fix We won't fix it.
Projects
None yet
Development

No branches or pull requests

1 participant