forked from Vizzuality/mangrove-atlas
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnext.config.js
More file actions
82 lines (75 loc) · 2.03 KB
/
Copy pathnext.config.js
File metadata and controls
82 lines (75 loc) · 2.03 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
const withMDX = require('@next/mdx')({
extension: /\.mdx?$/,
options: {
remarkPlugins: [],
rehypePlugins: [],
},
});
/** @type {import('next').NextConfig} */
const nextConfig = {
productionBrowserSourceMaps: false,
pageExtensions: ['ts', 'tsx', 'js', 'jsx', 'md', 'mdx'],
output: 'standalone',
poweredByHeader: false,
images: {
remotePatterns: [
{
protocol: 'https',
hostname: 'www.wetlands.org',
port: '',
pathname: '/wp-content/uploads/**',
},
],
},
async rewrites() {
return [
{
source: '/planet/:path*',
destination: `https://tiles.planet.com/basemaps/v1/planet-tiles/:path*?api_key=${process.env.NEXT_PUBLIC_PLANET_API_KEY}`,
},
{
source: '/planet-api/:path*',
destination: `https://api.planet.com/basemaps/v1/:path*?api_key=${process.env.NEXT_PUBLIC_PLANET_API_KEY}`,
},
{ source: '/blog/:path*', destination: `https://www.wetlands.org/:path*` },
{
source: '/proxy/:path*',
destination: `https://${process.env.NEXT_PUBLIC_MRTT_SITE}/auth/login/:path*`,
},
];
},
async headers() {
// Allow MRTT to load the silent-SSO authorize endpoint in an iframe.
// Any default frame-blocking header (e.g. X-Frame-Options: DENY emitted
// by upstream middleware / hosting) would silently break the silent-SSO
// iframe and cause silentSsoCheck() to time out without diagnostic.
const mrttOrigin = (() => {
try {
return new URL(process.env.NEXT_PUBLIC_MRTT_SITE).origin;
} catch {
return null;
}
})();
if (!mrttOrigin) return [];
return [
{
source: '/api/auth/sso/authorize',
headers: [
{
key: 'Content-Security-Policy',
value: `frame-ancestors 'self' ${mrttOrigin};`,
},
],
},
];
},
turbopack: {
rules: {
'*.mdx': {
loaders: ['@mdx-js/loader'],
as: '*.jsx',
},
},
},
};
module.exports = withMDX(nextConfig);