Is there an existing issue for this?
How do you use Sentry?
Sentry Saas (sentry.io)
Which SDK are you using?
@sentry/nextjs
SDK Version
7.64.0
Framework Version
Next.js 13.4.19
Link to Sentry event
No response
SDK Setup
On the server:
Sentry.init({dsn: process.env.NEXT_PUBLIC_SERVER_SENTRY_DSN,tracesSampleRate: 1,debug: false,release: process.env.NEXT_PUBLIC_SENTRY_RELEASE,});On the client:
Sentry.init({dsn: process.env.NEXT_PUBLIC_SERVER_SENTRY_DSN,tracesSampleRate: 1,debug: false,replaysOnErrorSampleRate: 1.0,replaysSessionSampleRate: 0.1,integrations: [newSentry.Replay({maskAllText: true,blockAllMedia: true,}),],release: process.env.NEXT_PUBLIC_SENTRY_RELEASE,tracePropagationTargets: ["http://localhost:3000","https://bowser.dev.ystv.co.uk","https://bowser.ystv.co.uk",],});In next.config.js:
module.exports=withSentryConfig(nextConfig,{silent: true,org: "ystv",project: "bowser-server",authToken: process.env.SENTRY_AUTH_TOKEN,release: sentryRelease,},{widenClientFileUpload: true,transpileClientSDK: false,tunnelRoute: "/monitoring",hideSourceMaps: true,disableLogger: true,disableClientWebpackPlugin: process.env.IS_PRODUCTION_BUILD!=="true",disableServerWebpackPlugin: process.env.IS_PRODUCTION_BUILD!=="true",},);Steps to Reproduce
- Set up the Next.js integration with
tunnelRoute enabled - Deploy the application on a hosting provider that does not set
Strict-Transport-Security - Visit a page in the application
- Watch the browser DevTools Network tab for a request to
/monitoring
Expected Result
No Strict-Transport-Security header is present on any response
Actual Result
The initial response from the backend does not have Strict-Transport-Security:

However, the response to the /monitoring request has the Strict-Transport-Security header from the Sentry SaaS backend:

Looking in chrome://net-internals#hsts you can indeed see that this has unintentionally enabled dynamic HSTS for the domain in question:

Any subsequent non-HTTPS requests to the domain will now fail.
Is there an existing issue for this?
How do you use Sentry?
Sentry Saas (sentry.io)
Which SDK are you using?
@sentry/nextjs
SDK Version
7.64.0
Framework Version
Next.js 13.4.19
Link to Sentry event
No response
SDK Setup
On the server:
On the client:
In
next.config.js:Steps to Reproduce
tunnelRouteenabledStrict-Transport-Security/monitoringExpected Result
No
Strict-Transport-Securityheader is present on any responseActual Result
The initial response from the backend does not have
Strict-Transport-Security:However, the response to the
/monitoringrequest has theStrict-Transport-Securityheader from the Sentry SaaS backend:Looking in chrome://net-internals#hsts you can indeed see that this has unintentionally enabled dynamic HSTS for the domain in question:

Any subsequent non-HTTPS requests to the domain will now fail.