I have a WebApp (Ionic App) and DotNet Core WebAPI service. I hosted it on 2 different IIS Server i.e. Server1 and Server2. Sometimes, my application doesn't behave correctly on Server2. When I debug the code and looked at logs, I found strange behavior in the WebAPI logs.
Server1: The app is working fine. If I look at the logs, I can see the HTTP/2.0 protocol for all the API requests. There is not a single request for HTTP/1.1.
Request starting HTTP/2.0
Server2: The app is not behaving properly. I can see two protocols for the API requests. Sometimes I can see HTTP/1.1 protocol and sometimes HTTP/2.0 protocol.
Request starting HTTP/1.1
Request starting HTTP/2.0
The main issue on Server2: These two protocols used for a single request. Let's say When I hit an API(GetData) from my app, I can see two requests of GetData in the logs. The only difference is both requests have different HTTP protocols i.e. HTTP/1.1 and HTTP/2.0.
When I check Chrome developer's tool for network calls, I can see only a single call made by the app. In the network tab, the protocol is HTTP/1.1. For the same request, I can see two different requests in the API logs with different HTTP protocols. Also, I can see that everything works fine on the HTTP/2.0 request in the API logs (the logic of the API) but my app has been waiting on the HTTP/1.1 request. So, my app doesn't get a response back from the API on HTTP/1.1 and shows an error on the app.
GetData API implementation: I am fetching some data from the 3rd party service. 3rd party service can return data only once for a single session id. As I am getting two requests (means, GetData code executing twice), I received the data from 3rd party service on HTTP/2.0 protocol request but not on HTTP/1.1. So, the request which uses HTTP/1.1 made a timeout and throw an error on the app.
Question: Can I control the HTTP protocol? If yes, I would like to set that every request serves on HTTP/2.0 OR HTTP/1.1. I have full control of the IIS Server so I can modify any configuration if It is required. Is something can be done with the TLS1.2 configuration?
UPDATE: I think that I got the root cause of the issue.
Server1: All the requests are using HTTP/2.0 protocol. (Checked IIS logs)
Server2: All the requests are using HTTP/1.1 protocol. (Checked IIS logs) But, still not sure which component is generating a new request for the HTTTP/2.0 protocol on Server2.
Well, I run a curl command and found out a new issue "HTTP/2 stream 0 was not closed cleanly: HTTP_1_1_REQUIRED (err 13)". I think that because of this issue, all the requests are using HTTP/1.1 protocol. If I fix it, all the service will use HTTP/2.0 protocol.
Issue:
Now, how I can fix this server issue? I don't want to handle this into the code. (I mean that specify HTTP protocol in the code)