next.config.ts 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. import type { NextConfig } from 'next'
  2. import createNextIntlPlugin from 'next-intl/plugin'
  3. const withNextIntl = createNextIntlPlugin()
  4. const nextConfig: NextConfig = {
  5. output: 'standalone',
  6. // Only for the image build that uploads them to PostHog error tracking and
  7. // deletes them again (scripts/upload-source-maps.sh). Every other build,
  8. // self-hosted ones included, makes none.
  9. productionBrowserSourceMaps: process.env.BROWSER_SOURCE_MAPS === 'true',
  10. images: {
  11. remotePatterns: [],
  12. },
  13. allowedDevOrigins: ['10.0.0.217', '192.168.30.111'],
  14. experimental: {
  15. proxyClientMaxBodySize: '2gb',
  16. },
  17. async headers() {
  18. return [
  19. // Every response. Later, more specific entries win on the same key, so
  20. // the status-report share below still gets its stricter values.
  21. {
  22. source: '/(.*)',
  23. headers: [
  24. { key: 'X-Content-Type-Options', value: 'nosniff' },
  25. // Nothing off this origin may frame the app; the app frames its own
  26. // previews and print views, so same-origin stays allowed.
  27. { key: 'X-Frame-Options', value: 'SAMEORIGIN' },
  28. { key: 'Referrer-Policy', value: 'strict-origin-when-cross-origin' },
  29. // Camera and microphone are used by our own pages (scanning, photos,
  30. // recordings); an embedded third-party frame gets neither.
  31. {
  32. key: 'Permissions-Policy',
  33. value: 'camera=(self), microphone=(self), geolocation=(self)',
  34. },
  35. ],
  36. },
  37. {
  38. source: '/share/status-report/:path*',
  39. headers: [
  40. { key: 'X-Robots-Tag', value: 'noindex, nofollow, noarchive, nosnippet' },
  41. { key: 'X-Frame-Options', value: 'DENY' },
  42. { key: 'Referrer-Policy', value: 'no-referrer' },
  43. { key: 'Cache-Control', value: 'no-store, no-cache, must-revalidate, private' },
  44. { key: 'X-Content-Type-Options', value: 'nosniff' },
  45. ],
  46. },
  47. ]
  48. },
  49. async rewrites() {
  50. return [
  51. // Old /api/files/ URLs stored in the DB before the protected/ restructure
  52. {
  53. source: '/api/files/:path*',
  54. destination: '/api/protected/files/:path*',
  55. },
  56. ]
  57. },
  58. }
  59. export default withNextIntl(nextConfig)