I am currently developing an application in Blazor Server for a company. The application is just a landing page with some information.
The way it works is that when the company's homepage is down for maintenance, the dns will be pointed to the IP of my solution instead and show information from an SQL database based on the hostname it has been redirected from. So far so good, all is working well.
I have a problem though. One of the requirements is that the application have to return a 307 (Temporary redirect) status code in order for google to understand that it is temporary.
But when I add this middleware to my Startup.cs:
app.Use(async (context, next) => {
context.Response.StatusCode = 307;
await next.Invoke();
});
the following error is occuring:
Error: Cannot send data if the connection is not in the 'Connected' State.
It seems that it has something to do with SignalR. Maybe it anticipates a page with status code 200? I am not familiar with the underlying logic of SignalR.
So my question is: Is there a workaround, so I can serve my blazor app to the client with a status code 307?
Thanks in advance.