Next.js Discord

Discord Forum

ERR_SSL_PROTOCOL_ERROR on Vercel Deployment with Next.js Middleware:

Unanswered
Sarabi dog posted this in #help-forum
Open in Discord
Sarabi dogOP
I’m encountering an ERR_SSL_PROTOCOL_ERROR with my Next.js application deployed on Vercel. The issue arises when accessing URLs with a custom subdomain. Everything works perfectly on localhost, but the problem occurs when the app is deployed. Here’s the relevant middleware code and details about the issue:

Middleware Code:


Issue Details
When testing the application using the Vercel-generated URL with a custom subdomain (e.g., https://dukaaaan.sinpshop-git-dev-mohsin-mohsin-hassans-projects.vercel.app/), I receive the following error:

This site can’t provide a secure connection
dukaaaan.sinpshop-git-dev-mohsin-mohsin-hassans-projects.vercel.app sent an invalid response.
ERR_SSL_PROTOCOL_ERROR

What I've Tried:

Verified Environment Variables: Ensured NEXT_PUBLIC_BASE_URL is correctly set in Vercel.
Checked SSL Configuration: Confirmed that Vercel handles SSL correctly for custom domains.
Debugged Middleware: Added additional logging to trace issues with URL handling.
Questions:

SSL Configuration: Are there specific settings or configurations in Vercel that I might be missing?
Middleware Issues: Could the middleware logic be causing SSL issues, and how might I adjust it?
Debugging Tips: Any additional debugging steps or tools to help diagnose this problem?
Any help or insights would be greatly appreciated!

0 Replies