Is this normal or any issue in the middleware configuration? I just want to confirm if the internationalization will cost the Edge Middleware Invocation or not.
Yes, it’s normal for the next-intl middleware to invoke Edge Middleware for every page request that matches the configured matcher. This behaviour is expected and is how the internationalization middleware works to handle language routing and preferences.
To optimize your setup, you could do the following:
Refining your matcher: Make sure you’re only invoking the middleware where necessary. Your current configuration looks good, but you might want to review if there are any other paths that could be excluded.
Caching strategies: Implement caching strategies where possible to reduce the number of dynamic page generations. This can help in minimizing the load on the Edge Middleware by serving cached responses for repeated requests.
Monitoring and analysis: Keep an eye on your Edge Middleware Invocations and correlate them with your traffic. This will help you understand if the invocations are proportional to your site’s usage.