Skip to content

Commit

Permalink
feat: added internal api proxy
Browse files Browse the repository at this point in the history
  • Loading branch information
JimmyLv committed Mar 18, 2023
1 parent d89e4fa commit 8cc9513
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 11 deletions.
1 change: 1 addition & 0 deletions .example.env
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,4 @@ NEXT_PUBLIC_SUPABASE_ANON_KEY=""
SENTRY_AUTH_TOKEN=
NEXT_PUBLIC_SEGMENT_WRITEKEY=
NEXT_PUBLIC_SITE_URL=
INTERNAL_API_HOSTNAME=
24 changes: 13 additions & 11 deletions next.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@
// with Sentry.
// https://nextjs.org/docs/api-reference/next.config.js/introduction
// https://docs.sentry.io/platforms/javascript/guides/nextjs/manual-setup/
const { withSentryConfig } = require('@sentry/nextjs');
const { withSentryConfig } = require("@sentry/nextjs");

/** @type {import('next').NextConfig} */
module.exports = {
reactStrictMode: true,
images: {
domains: [
process.env.SUPABASE_HOSTNAME || 'xxxx.supabase.co', // to prevent vercel failed
process.env.SUPABASE_HOSTNAME || "xxxx.supabase.co", // to prevent vercel failed
"b.jimmylv.cn",
"avatars.dicebear.com",
// "i2.hdslb.com",
Expand All @@ -18,19 +18,21 @@ module.exports = {
],
},
async rewrites() {
return {
fallback: [
{
source: "/blocked",
destination: "/shop",
},
],
};
return [
{
source: "/api/:path*",
destination: `${process.env.INTERNAL_API_HOSTNAME}/api/:path*`,
},
{
source: "/blocked",
destination: "/shop",
},
];
},
};

module.exports = withSentryConfig(
module.exports,
{ silent: true },
{ hideSourcemaps: true },
{ hideSourcemaps: true }
);

0 comments on commit 8cc9513

Please sign in to comment.