Issue
In our ASP.NET MVC web application, when submitting a form or navigating within the app, the request's origin is sometimes null instead of the expected domain name.
Current Setup
The ASP.NET MVC web app includes middleware that checks the Origin header. If the origin is null, the request is denied to prevent cross-domain requests. The middleware compares the Origin header with the Host header in the request to ensure they match.
Problem
Occasionally, the Origin header is null, causing the app to deny requests, even though they are originating from the same domain.
Required Solution
We need a solution to handle cases where the Origin header is null, while ensuring security and avoiding the denial of legitimate requests from the same origin.