srs icon indicating copy to clipboard operation
srs copied to clipboard

Using the http-flv protocol, the front-end request requires cross-origin access to obtain the flv stream. I have looked through the wiki but have not found an answer yet. Please help, thank you.

Open hyfsgit opened this issue 9 years ago • 8 comments

I only saw that http-api can support cross-origin in the wiki. I would like to ask if http-flv can also support cross-origin.

TRANS_BY_GPT3

hyfsgit avatar Oct 28 '17 08:10 hyfsgit

I face the same problem, too. My workaround is adding

w->header()->set("Access-Control-Allow-Origin", "*");

in https://github.com/ossrs/srs/blob/master/trunk/src/app/srs_app_http_stream.cpp#L485 . Hope it will have an option in the conf file in the future.

alon21034 avatar Oct 30 '17 10:10 alon21034

I resolved the problem with the same way yesterday, thanks for your help

hyfsgit avatar Oct 31 '17 01:10 hyfsgit

@hyfsgit Did you solve this problem by modifying the source code as mentioned above? I am currently facing the same issue.

TRANS_BY_GPT3

canglongxiang avatar Oct 31 '17 10:10 canglongxiang

It is the same method as the one used by the person upstairs. Modify the http-conn file and add an additional attribute in the response header.

TRANS_BY_GPT3

hyfsgit avatar Oct 31 '17 15:10 hyfsgit

All the same, we are modifying the source code, but we are modifying different files.

TRANS_BY_GPT3

hyfsgit avatar Nov 01 '17 00:11 hyfsgit

His method is a little safer, so you should still follow his method to make changes.

TRANS_BY_GPT3

hyfsgit avatar Nov 01 '17 00:11 hyfsgit

There are several solutions:

  1. Add an HTTP proxy: https://github.com/ossrs/go-oryx/tree/develop/httpx-static
  2. SRS3 supports CORS, but it is a bit complicated to merge it, so you can directly modify the code to support it, as shown above.

TRANS_BY_GPT3

winlinvip avatar Jan 04 '18 06:01 winlinvip

Dup to #717 #798 #1002 #1025

winlinvip avatar Jan 07 '18 02:01 winlinvip