Skip to content

Commit

Permalink
HLS: add CORS header to all responses (#389)
Browse files Browse the repository at this point in the history
  • Loading branch information
aler9 committed May 30, 2021
1 parent 9f0c519 commit 30e1ae0
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion internal/hlsconverter/converter.go
Original file line number Diff line number Diff line change
Expand Up @@ -533,6 +533,8 @@ func (c *Converter) runRequestHandler(terminate chan struct{}, done chan struct{
case preq := <-c.request:
req := preq

req.W.Header().Add("Access-Control-Allow-Origin", "*")

atomic.StoreInt64(&c.lastRequestTime, time.Now().Unix())

conf := c.path.Conf()
Expand Down Expand Up @@ -598,7 +600,6 @@ func (c *Converter) runRequestHandler(terminate chan struct{}, done chan struct{
req.Res <- f.buf.NewReader()

case req.FileName == "":
req.W.Header().Add("Access-Control-Allow-Origin", "*")
req.Res <- bytes.NewReader([]byte(index))

default:
Expand Down

0 comments on commit 30e1ae0

Please sign in to comment.