Skip to content

Commit

Permalink
Add CORP headers
Browse files Browse the repository at this point in the history
  • Loading branch information
turt2live committed Aug 17, 2022
1 parent 50d8f36 commit b821ac0
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),

## [Unreleased]

### Added

* Added the `Cross-Origin-Resource-Policy: cross-origin` header to all downloads, as per [MSC3828](https://github.com/matrix-org/matrix-spec-proposals/pull/3828).

### Changed

* Swap out the HEIF library for better support towards [ARM64 Docker Images](https://github.com/turt2live/matrix-media-repo/issues/365).
Expand Down
4 changes: 3 additions & 1 deletion api/webserver/route_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import (
"encoding/json"
"errors"
"fmt"
"github.com/getsentry/sentry-go"
"io"
"io/ioutil"
"math"
Expand All @@ -17,6 +16,8 @@ import (
"strconv"
"strings"

"github.com/getsentry/sentry-go"

"github.com/alioygur/is"
"github.com/prometheus/client_golang/prometheus"
"github.com/sebest/xff"
Expand Down Expand Up @@ -81,6 +82,7 @@ func (h handler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
w.Header().Set("Access-Control-Allow-Methods", "GET, POST, PUT, DELETE, OPTIONS")
w.Header().Set("Access-Control-Allow-Origin", "*")
w.Header().Set("Content-Security-Policy", "sandbox; default-src 'none'; script-src 'none'; plugin-types application/pdf; style-src 'unsafe-inline'; media-src 'self'; object-src 'self';")
w.Header().Set("Cross-Origin-Resource-Policy", "cross-origin")
w.Header().Set("X-Content-Security-Policy", "sandbox;")
w.Header().Set("X-Robots-Tag", "noindex, nofollow, noarchive, noimageindex")
w.Header().Set("Server", "matrix-media-repo")
Expand Down

0 comments on commit b821ac0

Please sign in to comment.