Enable HTTP2 in one of several name-based servers

Hi,

Is it possible to enable http2 in only one of several name-based
servers?

I have the following scenario:

server {
listen 443 ssl;
server_name www.example.com;
ssl_certificate www.example.com.crt;

}

server {
listen 443 ssl http2;
server_name www.example.org;
ssl_certificate www.example.org.crt;

}

Enabling http2 in the second server makes the first respond http2 as
well.

In my use case I have a few servers using modules that are not
http2-compatible yet.

Is there anything I’m missing?

Thanks!

On Wednesday 22 June 2016 18:32:47 Marcelo MD wrote:

Hi,

Is it possible to enable http2 in only one of several name-based servers?

[…]

No, it’s not possible.

wbr, Valentin V. Bartenev

On Thursday 23 June 2016 04:35:45 itpp2012 wrote:

What effect do you expect? Since clients are able to request different
hosts
using single HTTP/2 connection, closing the connection in one server
block
will break everything.

wbr, Valentin V. Bartenev

Valentin V. Bartenev Wrote:

Is it possible to enable http2 in only one of several name-based
servers?

[…]

No, it’s not possible.

Would it be a big (api) change to add a server block session flag?

ngx_http_v2_init(ngx_event_t rev)

if ( h2scf.no_http2 ) { /
example server block flag */
ngx_log_debug0(NGX_LOG_DEBUG_HTTP, c->log, 0, “http2 disabled in
server
context”);
ngx_http_close_connection(c);
return;
}

c->log->action = “processing HTTP/2 connection”;

Posted at Nginx Forum:

Valentin V. Bartenev Wrote:

What effect do you expect? Since clients are able to request
different hosts
using single HTTP/2 connection, closing the connection in one server
block
will break everything.

I’m just venting an (untested) idea, some other way to tell the client
to
revert back to pre-http2 connections when hitting a server block, maybe
a
simple return would be enough.

connect site.ru (h2)
connect.h2 site2.ru (deny h2, client should revert to http(s))

Posted at Nginx Forum:

Ok,

What about the other way around. Is it possible to disable http2 for one
server block, via config or via code?

Other than that, what are the alternatives? One listen on one IP for
http2
and on another for http1?

Thanks!

On Thu, Jun 23, 2016 at 7:06 AM, itpp2012 [email protected]