Skip to content

Commit

Permalink
fix: image hostname (#8)
Browse files Browse the repository at this point in the history
  • Loading branch information
sa02045 authored Feb 16, 2025
1 parent 79bdf83 commit 236c406
Showing 1 changed file with 13 additions and 53 deletions.
66 changes: 13 additions & 53 deletions next.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,40 +18,19 @@ const ContentSecurityPolicy = `

const securityHeaders = [
// https://developer.mozilla.org/en-US/docs/Web/HTTP/CSP
{
key: 'Content-Security-Policy',
value: ContentSecurityPolicy.replace(/\n/g, ''),
},
{ key: 'Content-Security-Policy', value: ContentSecurityPolicy.replace(/\n/g, '') },
// https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Referrer-Policy
{
key: 'Referrer-Policy',
value: 'strict-origin-when-cross-origin',
},
{ key: 'Referrer-Policy', value: 'strict-origin-when-cross-origin' },
// https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-Frame-Options
{
key: 'X-Frame-Options',
value: 'DENY',
},
{ key: 'X-Frame-Options', value: 'DENY' },
// https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-Content-Type-Options
{
key: 'X-Content-Type-Options',
value: 'nosniff',
},
{ key: 'X-Content-Type-Options', value: 'nosniff' },
// https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-DNS-Prefetch-Control
{
key: 'X-DNS-Prefetch-Control',
value: 'on',
},
{ key: 'X-DNS-Prefetch-Control', value: 'on' },
// https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Strict-Transport-Security
{
key: 'Strict-Transport-Security',
value: 'max-age=31536000; includeSubDomains',
},
{ key: 'Strict-Transport-Security', value: 'max-age=31536000; includeSubDomains' },
// https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Feature-Policy
{
key: 'Permissions-Policy',
value: 'camera=(), microphone=(), geolocation=()',
},
{ key: 'Permissions-Policy', value: 'camera=(), microphone=(), geolocation=()' },
]

const isProd = process.env.NODE_ENV === 'production'
Expand All @@ -70,39 +49,20 @@ module.exports = () => {
basePath,
reactStrictMode: true,
pageExtensions: ['ts', 'tsx', 'js', 'jsx', 'md', 'mdx'],
eslint: {
dirs: ['app', 'components', 'layouts', 'scripts'],
},
eslint: { dirs: ['app', 'components', 'layouts', 'scripts'] },
images: {
remotePatterns: [
{
protocol: 'https',
hostname: 'res.cloudinary.com',
},
{
protocol: 'https',
hostname: 'sa02045.github.io',
},
{
protocol: 'https',
hostname: 'github.com',
},
{ protocol: 'https', hostname: 'res.cloudinary.com' },
{ protocol: 'https', hostname: 'sa02045.github.io' },
{ protocol: 'https', hostname: 'github.io' },
],
},

async headers() {
return [
{
source: '/(.*)',
headers: securityHeaders,
},
]
return [{ source: '/(.*)', headers: securityHeaders }]
},
webpack: (config, options) => {
config.module.rules.push({
test: /\.svg$/,
use: ['@svgr/webpack'],
})
config.module.rules.push({ test: /\.svg$/, use: ['@svgr/webpack'] })

return config
},
Expand Down

0 comments on commit 236c406

Please sign in to comment.