Compare commits
4 Commits
v1.2.11-rc
...
v1.2.13
| Author | SHA1 | Date | |
|---|---|---|---|
| f4fdb89ba4 | |||
| 9de3931e33 | |||
| b10dbcb23f | |||
| 65bb9c620a |
@@ -50,14 +50,14 @@ jobs:
|
|||||||
uses: actions/cache@v4
|
uses: actions/cache@v4
|
||||||
with:
|
with:
|
||||||
path: .turbo
|
path: .turbo
|
||||||
key: ${{ runner.os }}-turbo-${{ github.ref_name }}-${{ github.sha }}
|
key: ${{ runner.os }}-turbo-global-${{ github.sha }}
|
||||||
restore-keys: |
|
restore-keys: |
|
||||||
${{ runner.os }}-turbo-${{ github.ref_name }}-
|
${{ runner.os }}-turbo-global-
|
||||||
${{ runner.os }}-turbo-
|
${{ runner.os }}-turbo-
|
||||||
|
|
||||||
- name: 🧪 QA Checks
|
- name: 🧪 QA Checks
|
||||||
env:
|
env:
|
||||||
TURBO_TELEMETRY_DISABLED: 1
|
TURBO_TELEMETRY_DISABLED: "1"
|
||||||
run: npx turbo run check:mdx lint typecheck test --cache-dir=".turbo"
|
run: npx turbo run check:mdx lint typecheck test --cache-dir=".turbo"
|
||||||
|
|
||||||
- name: 🏗️ Build
|
- name: 🏗️ Build
|
||||||
|
|||||||
@@ -175,9 +175,9 @@ jobs:
|
|||||||
uses: actions/cache@v4
|
uses: actions/cache@v4
|
||||||
with:
|
with:
|
||||||
path: .turbo
|
path: .turbo
|
||||||
key: ${{ runner.os }}-turbo-${{ github.ref_name }}-${{ github.sha }}
|
key: ${{ runner.os }}-turbo-global-${{ github.sha }}
|
||||||
restore-keys: |
|
restore-keys: |
|
||||||
${{ runner.os }}-turbo-${{ github.ref_name }}-
|
${{ runner.os }}-turbo-global-
|
||||||
${{ runner.os }}-turbo-
|
${{ runner.os }}-turbo-
|
||||||
|
|
||||||
- name: 🔒 Security Audit
|
- name: 🔒 Security Audit
|
||||||
@@ -185,7 +185,7 @@ jobs:
|
|||||||
- name: 🧪 QA Checks
|
- name: 🧪 QA Checks
|
||||||
if: github.event.inputs.skip_checks != 'true'
|
if: github.event.inputs.skip_checks != 'true'
|
||||||
env:
|
env:
|
||||||
TURBO_TELEMETRY_DISABLED: 1
|
TURBO_TELEMETRY_DISABLED: "1"
|
||||||
run: npx turbo run lint check:spell typecheck test --cache-dir=".turbo"
|
run: npx turbo run lint check:spell typecheck test --cache-dir=".turbo"
|
||||||
|
|
||||||
# ──────────────────────────────────────────────────────────────────────────────
|
# ──────────────────────────────────────────────────────────────────────────────
|
||||||
|
|||||||
@@ -41,8 +41,7 @@ CMD ["pnpm", "dev:local"]
|
|||||||
# Build application
|
# Build application
|
||||||
# Stage 3: Builder (Production)
|
# Stage 3: Builder (Production)
|
||||||
FROM base AS builder
|
FROM base AS builder
|
||||||
RUN --mount=type=cache,target=/app/.next/cache,id=nextjs-cache \
|
RUN pnpm build
|
||||||
pnpm build
|
|
||||||
|
|
||||||
# Stage 3: Runner
|
# Stage 3: Runner
|
||||||
FROM registry.infra.mintel.me/mintel/runtime:v1.7.10 AS runner
|
FROM registry.infra.mintel.me/mintel/runtime:v1.7.10 AS runner
|
||||||
|
|||||||
@@ -10,10 +10,38 @@ const intlMiddleware = createMiddleware({
|
|||||||
defaultLocale: 'en',
|
defaultLocale: 'en',
|
||||||
});
|
});
|
||||||
|
|
||||||
export default function middleware(request: NextRequest) {
|
const imgproxyStatus = { isDown: false, lastCheck: 0 };
|
||||||
|
|
||||||
|
async function isImgproxyDown() {
|
||||||
|
const now = Date.now();
|
||||||
|
if (now - imgproxyStatus.lastCheck > 60000) {
|
||||||
|
try {
|
||||||
|
const imgproxyUrl = process.env.IMGPROXY_URL || 'https://img.infra.mintel.me';
|
||||||
|
const checkUrl = imgproxyUrl.startsWith('http') ? imgproxyUrl : `https://${imgproxyUrl}`;
|
||||||
|
const res = await fetch(checkUrl, { signal: AbortSignal.timeout(2000) });
|
||||||
|
imgproxyStatus.isDown = res.status >= 500;
|
||||||
|
} catch (e) {
|
||||||
|
imgproxyStatus.isDown = true;
|
||||||
|
}
|
||||||
|
imgproxyStatus.lastCheck = now;
|
||||||
|
}
|
||||||
|
return imgproxyStatus.isDown;
|
||||||
|
}
|
||||||
|
|
||||||
|
export default async function middleware(request: NextRequest) {
|
||||||
const { method, url, headers } = request;
|
const { method, url, headers } = request;
|
||||||
const { pathname } = request.nextUrl;
|
const { pathname } = request.nextUrl;
|
||||||
|
|
||||||
|
if (pathname.startsWith('/_img/')) {
|
||||||
|
if (await isImgproxyDown()) {
|
||||||
|
const originalUrl = request.nextUrl.searchParams.get('url');
|
||||||
|
if (originalUrl) {
|
||||||
|
return NextResponse.redirect(originalUrl);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return NextResponse.next();
|
||||||
|
}
|
||||||
|
|
||||||
// Explicit bypass for infrastructure routes to avoid locale redirects/interception
|
// Explicit bypass for infrastructure routes to avoid locale redirects/interception
|
||||||
if (
|
if (
|
||||||
pathname.startsWith('/stats') ||
|
pathname.startsWith('/stats') ||
|
||||||
@@ -97,7 +125,7 @@ export default function middleware(request: NextRequest) {
|
|||||||
|
|
||||||
export const config = {
|
export const config = {
|
||||||
matcher: [
|
matcher: [
|
||||||
'/((?!api|_next/static|_next/image|_img|favicon.ico|manifest.webmanifest|.*\\.(?:svg|png|jpg|jpeg|gif|webp|pdf|txt|vcf|xml|webm|mp4|map)$).*)',
|
'/((?!api|_next/static|_next/image|favicon.ico|manifest.webmanifest|.*\\.(?:svg|png|jpg|jpeg|gif|webp|pdf|txt|vcf|xml|webm|mp4|map)$).*)',
|
||||||
'/(de|en)/:path*',
|
'/(de|en)/:path*',
|
||||||
'/(de|en)/:path*',
|
'/(de|en)/:path*',
|
||||||
],
|
],
|
||||||
|
|||||||
Reference in New Issue
Block a user