add env var: UPTIME_KUMA_DISABLE_FRAME_SAMEORIGIN

This commit is contained in:
Louis Lam 2021-10-19 14:41:05 +08:00
parent c57c94642c
commit 5c3892313e
2 changed files with 7 additions and 3 deletions

View file

@ -31,14 +31,15 @@ WORKDIR /
RUN apt update && \ RUN apt update && \
apt --yes install curl file apt --yes install curl file
COPY --from=build /app /app
ARG VERSION=1.9.1
ARG GITHUB_TOKEN ARG GITHUB_TOKEN
ARG TARGETARCH ARG TARGETARCH
ARG PLATFORM=debian ARG PLATFORM=debian
ARG VERSION=1.9.0
ARG FILE=$PLATFORM-$TARGETARCH-$VERSION.tar.gz ARG FILE=$PLATFORM-$TARGETARCH-$VERSION.tar.gz
ARG DIST=dist.tar.gz ARG DIST=dist.tar.gz
COPY --from=build /app /app
RUN chmod +x /app/extra/upload-github-release-asset.sh RUN chmod +x /app/extra/upload-github-release-asset.sh
# Full Build # Full Build

View file

@ -77,6 +77,7 @@ const port = parseInt(process.env.UPTIME_KUMA_PORT || process.env.PORT || args.p
// SSL // SSL
const sslKey = process.env.UPTIME_KUMA_SSL_KEY || process.env.SSL_KEY || args["ssl-key"] || undefined; const sslKey = process.env.UPTIME_KUMA_SSL_KEY || process.env.SSL_KEY || args["ssl-key"] || undefined;
const sslCert = process.env.UPTIME_KUMA_SSL_CERT || process.env.SSL_CERT || args["ssl-cert"] || undefined; const sslCert = process.env.UPTIME_KUMA_SSL_CERT || process.env.SSL_CERT || args["ssl-cert"] || undefined;
const disableFrameSameOrigin = !!process.env.UPTIME_KUMA_DISABLE_FRAME_SAMEORIGIN || false;
// 2FA / notp verification defaults // 2FA / notp verification defaults
const twofa_verification_opts = { const twofa_verification_opts = {
@ -121,7 +122,9 @@ app.use(express.json());
// Global Middleware // Global Middleware
app.use(function (req, res, next) { app.use(function (req, res, next) {
if (disableFrameSameOrigin) {
res.setHeader("X-Frame-Options", "SAMEORIGIN"); res.setHeader("X-Frame-Options", "SAMEORIGIN");
}
res.removeHeader("X-Powered-By"); res.removeHeader("X-Powered-By");
next(); next();
}); });