Skip to content

Commit

Permalink
Fix TTFs returning bad request error
Browse files Browse the repository at this point in the history
Proxied URLs from Google fonts CDN are failing with error 400.
That is because the content-type is `font/ttf` which prior to this
commit, was not supported.
  • Loading branch information
MrSaints committed Nov 2, 2017
1 parent 4d35661 commit 30926ab
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 9 deletions.
9 changes: 0 additions & 9 deletions pkg/camo/proxy.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,6 @@ import (
"github.com/cactus/mlog"
)

var acceptedContentTypes = []string{
"application/font-woff",
"application/vnd.ms-fontobject",
"application/x-font",
"image/",
"text/css",
}
var defaultAcceptHeaders = "image/*, text/*, application/*"

// Config holds configuration data used when creating a Proxy with New.
type Config struct {
// HMACKey is a byte slice to be used as the hmac key
Expand Down
11 changes: 11 additions & 0 deletions pkg/camo/vars.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,17 @@ import (
"regexp"
)

var acceptedContentTypes = []string{
"application/font-woff",
"application/vnd.ms-fontobject",
"application/x-font",
"font/",
"image/",
"text/css",
}

var defaultAcceptHeaders = "image/*, font/*, text/*, application/*"

// ValidReqHeaders are http request headers that are acceptable to pass from
// the client to the remote server. Only those present and true, are forwarded.
// Empty implies no filtering.
Expand Down

0 comments on commit 30926ab

Please sign in to comment.