Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
Metabase
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Engineering Digital Service
Metabase
Commits
435ebc0e
Unverified
Commit
435ebc0e
authored
6 years ago
by
Tom Robinson
Committed by
GitHub
6 years ago
Browse files
Options
Downloads
Plain Diff
Merge pull request #8851 from metabase/fe-perf-fixes-0.31
Frontend perf fixes 0.31
parents
2f89cb02
0a827015
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/metabase/middleware.clj
+17
-4
17 additions, 4 deletions
src/metabase/middleware.clj
webpack.config.js
+5
-5
5 additions, 5 deletions
webpack.config.js
yarn.lock
+196
-121
196 additions, 121 deletions
yarn.lock
with
218 additions
and
130 deletions
src/metabase/middleware.clj
+
17
−
4
View file @
435ebc0e
...
...
@@ -39,6 +39,11 @@
[{
:keys
[
uri
]}]
(
re-matches
#
"^/embed/.*$"
uri
))
(
defn-
cacheable?
"Can the ring request be permanently cached?"
[{
:keys
[
uri
query-string
]}]
;; match requests that are js/css and have a cache-busting query string
(
and
query-string
(
re-matches
#
"^/app/dist/.*\.(js|css)$"
uri
)))
;;; ------------------------------------------- AUTH & SESSION MANAGEMENT --------------------------------------------
...
...
@@ -168,6 +173,11 @@
"Expires"
"Tue, 03 Jul 2001 06:00:00 GMT"
"Last-Modified"
(
du/format-date
:rfc822
)})
(
defn-
cache-far-future-headers
"Headers that tell browsers to cache a static resource for a long time."
[]
{
"Cache-Control"
"public, max-age=31536000"
})
(
def
^
:private
^
:const
strict-transport-security-header
"Tell browsers to only access this resource over HTTPS for the next year (prevent MTM attacks). (This only applies if
the original request was HTTPS; if sent in response to an HTTP request, this is simply ignored)"
...
...
@@ -216,10 +226,12 @@
(
when-let
[
k
(
ssl-certificate-public-key
)]
{
"Public-Key-Pins"
(
format
"pin-sha256=\"base64==%s\"; max-age=31536000"
k
)}))
(
defn-
security-headers
[
&
{
:keys
[
allow-iframes?
]
:or
{
allow-iframes?
false
}}]
(
defn-
security-headers
[
&
{
:keys
[
allow-iframes?
allow-cache?
]
:or
{
allow-iframes?
false,
allow-cache?
false
}}]
(
merge
(
cache-prevention-headers
)
(
if
allow-cache?
(
cache-far-future-headers
)
(
cache-prevention-headers
))
strict-transport-security-header
content-security-policy-header
#
_
(
public-key-pins-header
)
...
...
@@ -239,7 +251,8 @@
(
fn
[
request
]
(
let
[
response
(
handler
request
)]
;; add security headers to all responses, but allow iframes on public & embed responses
(
update
response
:headers
merge
(
security-headers
:allow-iframes?
((
some-fn
public?
embed?
)
request
))))))
(
update
response
:headers
merge
(
security-headers
:allow-iframes?
((
some-fn
public?
embed?
)
request
)
:allow-cache?
(
cacheable?
request
))))))
(
defn
add-content-type
"Add an appropriate Content-Type header to response if it doesn't already have one. Most responses should already
...
...
This diff is collapsed.
Click to expand it.
webpack.config.js
+
5
−
5
View file @
435ebc0e
...
...
@@ -257,15 +257,15 @@ if (NODE_ENV !== "production") {
config
.
output
.
devtoolModuleFilenameTemplate
=
"
[absolute-resource-path]
"
;
config
.
output
.
pathinfo
=
true
;
}
else
{
// this is required to ensure we don't minify Chevrotain token identifiers
// https://github.com/SAP/chevrotain/tree/master/examples/parser/minification
const
tokens
=
allTokens
.
map
(
currTok
=>
chevrotain
.
tokenName
(
currTok
));
config
.
plugins
.
push
(
new
UglifyJSPlugin
({
test
:
/
\.
jsx
?(
$|
\?)
/i
,
uglifyOptions
:
{
mangle
:
{
// this is required to ensure we don't minify Chevrotain token identifiers
// https://github.com/SAP/chevrotain/tree/master/examples/parser/minification
except
:
allTokens
.
map
(
function
(
currTok
)
{
return
chevrotain
.
tokenName
(
currTok
);
}),
reserved
:
tokens
,
},
},
})
...
...
This diff is collapsed.
Click to expand it.
yarn.lock
+
196
−
121
View file @
435ebc0e
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment