Compare commits
3
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
eeda1563fd | ||
|
|
ee7be33fa1 | ||
|
|
e6a821ecc3 |
No files matched your search
+3
-2
@@ -41,7 +41,7 @@ LABEL org.opencontainers.image.documentation='https://github.com/gethomepage/hom
|
|||||||
LABEL org.opencontainers.image.source='https://github.com/gethomepage/homepage'
|
LABEL org.opencontainers.image.source='https://github.com/gethomepage/homepage'
|
||||||
LABEL org.opencontainers.image.licenses='Apache-2.0'
|
LABEL org.opencontainers.image.licenses='Apache-2.0'
|
||||||
|
|
||||||
ENV NODE_ENV production
|
ENV NODE_ENV=production
|
||||||
|
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
@@ -56,7 +56,8 @@ COPY --link --chmod=755 docker-entrypoint.sh /usr/local/bin/
|
|||||||
|
|
||||||
RUN apk add --no-cache su-exec
|
RUN apk add --no-cache su-exec
|
||||||
|
|
||||||
ENV PORT 3000
|
ENV HOSTNAME=::
|
||||||
|
ENV PORT=3000
|
||||||
EXPOSE $PORT
|
EXPOSE $PORT
|
||||||
|
|
||||||
HEALTHCHECK --interval=10s --timeout=3s --start-period=20s \
|
HEALTHCHECK --interval=10s --timeout=3s --start-period=20s \
|
||||||
|
|||||||
@@ -0,0 +1,18 @@
|
|||||||
|
import { NextResponse } from "next/server";
|
||||||
|
|
||||||
|
export function middleware(req) {
|
||||||
|
// Check the Host header, if HOMEPAGE_ALLOWED_HOSTS is set
|
||||||
|
const host = req.headers.get("host");
|
||||||
|
const allowedHosts = process.env.HOMEPAGE_ALLOWED_HOSTS
|
||||||
|
? process.env.HOMEPAGE_ALLOWED_HOSTS.split(",").concat(["localhost:3000"])
|
||||||
|
: [];
|
||||||
|
console.log("Host: ", host, "Allowed Hosts: ", allowedHosts);
|
||||||
|
if (allowedHosts.length && !(host || allowedHosts.includes(host))) {
|
||||||
|
return new NextResponse("Invalid Host header", { status: 400 });
|
||||||
|
}
|
||||||
|
return NextResponse.next();
|
||||||
|
}
|
||||||
|
|
||||||
|
export const config = {
|
||||||
|
matcher: "/api/:path*",
|
||||||
|
};
|
||||||
Reference in new issue
Block a user