App Service does not support Server Push in Http2
Published Apr 24 2023 11:18 PM 1,999 Views
Microsoft

Nowadays, the Internet became so entrenched in our daily lives, with the increasing use of mobile, cloud, websites, we're always looking for a faster and more efficient method of communicating data. It finally came to the new protocol HTTP/2 announced by IETF in 2015, which is a more modernized, faster and more secure version, almost all major web browsers are on board so far.

As one of the powerful app platform providers, App service team also announced the support for the HTTP/2 protocol  for all apps hosted on App Service in March 2018.

 

What are the key differences from HTTP/1.x on app service?

 

  • HTTP/2 is binary
  • Fully multiplexed, instead of ordered and blocking
  • Ability to use one connection for parallelism
  • Has one TCP/IP connection per origin
  • Uses header compression to reduce overhead

You could easily configure the app service through portal  or resource explorar  to enable HTTP/2 and benefit from above mentioning technologies.

But today I'd like to talk about Server push feature on app service.

 

Server Push - Http/2

 

Another new feature of HTTP/2 introduced to the public is Server Push, which allows the server to send multiple responses for a single client request, even if the client didn't request for.

HTTP/2 breaks away from the strict request-response semantics and enables one-to-many and server-initiated push workflows that open up a world of new interaction possibilities both within and outside the browser. Server push is one of

There has been a lively discussion online about the substantial improvements in website performance VS the issues brought about(e.g. cache busting) by Server Push and the applicable use cases. The various standards groups are still trying to make it work in practice too.

 

Underlying Reason of non-support Server Push on App Service

 

Recently, we've received some customer's feedbacks that while using HttpResponse.PushPromise  in .NET v4.8, the app running on app service will give below error:

System.UnauthorizedAccessException: Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED))

This is expected.

HttpResponse.PushPromise  supports applications sending push promises to HTTP/2 clients. All server push streams are initiated via PUSH_PROMISE  frames, which signal the server’s intent to push the described resources to the client and need to be delivered ahead of the response data that requests the pushed resources.

However HTTP/2 on app services is implemented on upstream front-end role  rather than the worker  where the app is running, hence any code level implementation to use PUSH_PROMISE frame will not work.

"The front end is a layer seven-load balancer, acting as a proxy, distributing incoming HTTP requests between different applications and their respective Workers." 

 

In addition to the above reason, from app service's perspective, we doesn't support it technically for now. Meanwhile we don't recommend server applications to have logic that depends on it, taking into account that HttpResponse.PushPromise  is only available in .NET v4.x , and is not supported on .NET CORE  or may not get supported in .NET 5 or later versions .

We don't deny the benefits and performance improvement of the Server Push, but we also needs to be careful to its inconsistency across browsers and how much optimization it actually brings. It does improve performance, but requires a careful testing in advance, otherwise it could also be a waste of bandwidth.

We believe it could be a powerful feature in the future with smarter servers( e.g. which allow us to correctly prioritise the streaming of content) and once bugs are fixed, it will become ideal for the kinds of assets we currently inline, the team will continue to evaluate and look for the most secure and stable practice.

 

Workarounds

 

For now you may consider WebSockets , SignalR , if you need to additionally push information to client. PushPromise is non-deterministic, you may note that HTTP/2 PUSH is not an event API, the client still has to request the resource from the HTTP stack. HTTP/2 push isn't enforceable and might be ignored by some intermediaries such as proxy or even the browser.

 

Reference:

 

.NET Core will not support HTTPS/2 server push 

Chrome's intent to remove HTTP/2 server push 

Performance studies for HTTPS/2 server push [1]  [2]  [3] 

Co-Authors
Version history
Last update:
‎Apr 24 2023 01:21 AM
Updated by: