Skip to content

Commit

Permalink
Fixed CORS again
Browse files Browse the repository at this point in the history
  • Loading branch information
joshholly authored Jun 14, 2024
1 parent 276915a commit 9debb90
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions dist/libraries/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -614,16 +614,12 @@ async function proxyTs(url, headers, req, res) {
},
};

// Set CORS headers
res.setHeader("Access-Control-Allow-Origin", "*");
res.setHeader("Access-Control-Allow-Headers", "*");
res.setHeader("Access-Control-Allow-Methods", "*");

// Proxy request and pipe to client
try {
if (forceHTTPS) {
const proxy = node_https_1.default.request(options, (r) => {
r.headers["content-type"] = "video/mp2t";
r.headers["Access-Control-Allow-Origin"] = "*";
res.writeHead(r.statusCode ?? 200, r.headers);
r.pipe(res, {
end: true,
Expand All @@ -636,6 +632,7 @@ async function proxyTs(url, headers, req, res) {
else {
const proxy = node_http_1.default.request(options, (r) => {
r.headers["content-type"] = "video/mp2t";
r.headers["Access-Control-Allow-Origin"] = "*";
res.writeHead(r.statusCode ?? 200, r.headers);
r.pipe(res, {
end: true,
Expand Down

0 comments on commit 9debb90

Please sign in to comment.