mirror of
https://github.com/kingomarnajjar/flex-template-web.git
synced 2026-07-26 06:47:17 +10:00
Skip basic auth for static resources
This commit is contained in:
parent
0a2f3a4faa
commit
32ff790277
1 changed files with 7 additions and 5 deletions
|
|
@ -77,17 +77,19 @@ if (TRUST_PROXY === 'true') {
|
|||
app.set('trust proxy', TRUST_PROXY);
|
||||
}
|
||||
|
||||
// Use basic authentication when not in dev mode.
|
||||
app.use(compression());
|
||||
app.use('/static', express.static(path.join(buildPath, 'static')));
|
||||
app.use(cookieParser());
|
||||
|
||||
// Use basic authentication when not in dev mode. This is
|
||||
// intentionally after the static middleware to skip basic auth for
|
||||
// static resources.
|
||||
if (!dev) {
|
||||
const USERNAME = process.env.BASIC_AUTH_USERNAME;
|
||||
const PASSWORD = process.env.BASIC_AUTH_PASSWORD;
|
||||
app.use(auth.basicAuth(USERNAME, PASSWORD));
|
||||
}
|
||||
|
||||
app.use(compression());
|
||||
app.use('/static', express.static(path.join(buildPath, 'static')));
|
||||
app.use(cookieParser());
|
||||
|
||||
const noCacheHeaders = {
|
||||
'Cache-control': 'no-cache, no-store, must-revalidate',
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue