https://bz.apache.org/bugzilla/show_bug.cgi?id=64171

            Bug ID: 64171
           Summary: Apache HTTP2 h2c mode not working properly
           Product: Apache httpd-2
           Version: 2.4.29
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: mod_http2
          Assignee: [email protected]
          Reporter: [email protected]
  Target Milestone: ---

I have tried to enable h2c mode on one of my virtual host, so I can use HTTP2.0
protocol. In my virtual host configuration I have included the line:

Protocols h2 h2c http/1.1

But I got errors that HTTP2 was not supported because of MPM. As potential
solutions to the problem I have tried with disabling mpm prefork and enabling
mpm event mode but it doesn't work as expected.

Currently I'm using apache 2.4.29 on Ubuntu.

Case 1) curl requesting http2 upgrade

$ curl -vs --http2 http://domain1.com
* Rebuilt URL to: http://domain1.com/
*   Trying 127.0.0.1...
* TCP_NODELAY set
* Connected to domain1.com (127.0.0.1) port 80 (#0)
> GET / HTTP/1.1
> Host: domain1.com
> User-Agent: curl/7.58.0
> Accept: */*
> Connection: Upgrade, HTTP2-Settings
> Upgrade: h2c
> HTTP2-Settings: AAMAAABkAARAAAAAAAIAAAAA
> 
< HTTP/1.1 101 Switching Protocols
< Upgrade: h2c
< Connection: Upgrade
* Received 101
* Using HTTP2, server supports multi-use
* Connection state changed (HTTP/2 confirmed)
* Copying HTTP/2 data in stream buffer to connection buffer after upgrade:
len=28
* Connection state changed (MAX_CONCURRENT_STREAMS updated)!
< HTTP/2 200 
< date: Sun, 00 Jan 1900 00:00:00 GMT
< server: Apache/2.4.29 (Ubuntu)
< last-modified: Fri, 29 Mar 2019 13:52:29 GMT
< etag: W/"2aa6-5853bfb4c71ac"
< accept-ranges: bytes
< content-length: 10918
< vary: Accept-Encoding
< content-type: text/html
< 
.... [snip website code] ....

Case 2) curl directly using http2

$ curl -vs --http2-prior-knowledge http://domain1.com
* Rebuilt URL to: http://domain1.com/
*   Trying 127.0.0.1...
* TCP_NODELAY set
* Connected to domain1.com (127.0.0.1) port 80 (#0)
* Using HTTP2, server supports multi-use
* Connection state changed (HTTP/2 confirmed)
* Copying HTTP/2 data in stream buffer to connection buffer after upgrade:
len=0
* Using Stream ID: 1 (easy handle 0x5604f1cb1580)
> GET / HTTP/2
> Host: domain1.com
> User-Agent: curl/7.58.0
> Accept: */*
> 
* http2 error: Remote peer returned unexpected data while we expected SETTINGS
frame.  Perhaps, peer does not support HTTP/2 properly.

The only solution I have found to make it work is enbling h2c in the default
virtual host (000-default.conf). This way everything seems to be working fine.
But, the h2c mode is then extended to any of the virtual hosts I have.

Another potential solution I have tested and that is working is to enable the
protocols h2 and h2c in every virtual host by modifying the
mods-enabled/http2.load file:

LoadModule http2_module /usr/lib/apache2/modules/mod_http2.so

<IfModule http2_module>
   Protocols h2 h2c http/1.1
</IfModule>

Any of the above mentioned options seems to make the system works as expected
both with protocol negotiation and with prior knowledge.

I guess either it's a configuration issue or a bug, that h2c is not possible to
be enable on per host basics.

Sorry if this is not considered a bug, but I guess it is not the expected
behaviour for developers that doesn't want to include h2 mode from the
beginning.

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to