HTTP/2 over IPV6: Multi-IP

ZipperZapper

Verified User
Joined
Nov 30, 2015
Messages
142
Since a few days my provider provided my homeadress with IPv6. In combination with the "HTTP/2 and SPDY indicator"-extension in Firefox, I noticed my websites aren't served over HTTP/2 when I'm surfing over IPv6. When I use a line with IPv4, HTTP/2 is used.

After checking the Nginx-configfiles, I found something interesting. I use this:

server
{
listen |IP|:|PORT_443| ssl http2;
|MULTI_IP|
}

This turns into:

server
{
listen myIPv4:443 ssl http2;
listen [myIPv6]:443 ssl;
}

Turns out the |MULTI_IP| token assigns the 'listen' part in front and the ':443 ssl;' part at the back by default, but there's no way to assign http2 too? You can't add it in the config file after |MULTI_IP|, because that will look like this and obviously fail:

listen [myIPv6]:443 ssl; http2;

Any ideas on how to fix/improve this? Tried to look for the place where |MULTI_IP| is defined (the 'listen' and ':443 ssl;' need to come from somewhere), but can't find it.
 
Last edited:
Change

Code:
|MULTI_IP|

to:

Code:
|$/usr/local/bin/php
<?php
$data = <<<END
|MULTI_IP|
END;
$data = str_replace("ssl;", "ssl http2;", $data);
echo  $data;
?>
DONE|

Congratulations on getting IPv6 :) I'm already waiting for a loooong time
 
Thanks, will try that one. Maybe something for DirectAdmin John to look at for the future.

Arnhem zie ik? Ziggo heeft IPv6 hier in Groningen wel aangezet
 
They do not read all the threads on the forums, so you might need to open a ticket in order to bring this issue to their consideration.
 
Will do, thanks. The fix Erulezz provided here doesn't seem to work by the way. The code literally ends up in the Nginx config, after which Nginx throws an error.

Fixed it by just removing the MULTI_IP token and adding my servers IPv6 address by hand for now.
 
Last edited:
That's weird! Works perfectly here. Did you paste it in the custom nginx_server_secure template or in Custom Httpd configs? Because this only works if you copy the nginx_server_secure.conf from /usr/local/directadmin/data/templates/ to custom/. and do a ./build rewrite_confs.

I will open a feature request soon to enable this more easier and better. At least to build the http2 module into nginx by default because it is now widely available in the stable build.
 
Yes, I always use my custom configs, so this is added to /usr/local/directadmin/data/custom/nginx_server_secure.conf:

server
{
listen |IP|:|PORT_443| ssl http2;
|$/usr/local/bin/php
<?php
$data = <<<END
|MULTI_IP|
END;
$data = str_replace("ssl;", "ssl http2;", $data);
echo $data;
?>
DONE|
}

But this won't work. After doing a rewrite_confs it throws an error:
Starting nginx: nginx: [emerg] unknown directive "|$/usr/local/bin/php"

And my IP is added to the hosting config, but all the PHP code is also there:

server
{
listen myIPv4:443 ssl http2;
|$/usr/local/bin/php
<?php
$data = <<<END
listen [myIPv6]:443 ssl;
END;
$data = str_replace("ssl;", "ssl http2;", $data);
echo $data;
?>
DONE|
 
Hello,

PHP:
|$/usr/local/bin/php
<?php
$data = <<<END
listen [myIPv6]:443 ssl;
END;
$data = str_replace("ssl;", "ssl http2;", $data);
echo $data;
?>
DONE|

There should NOT be any tab or white-space before the instruction in the line, every single line should start without any space and without tab if you want it to work.
 
A well, I like my tidy markup, so I used tabs. Didn't think about it. Removing them indeed fixed the problem, the solution works now.
 
Back
Top