nghttp2

What is wrong with my nghttp2.conf backend pattern?


Here is my nghttpx.conf file:

frontend=0.0.0.0,3000
backend=127.0.0.0,9901;;proto=h2
frontend-no-tls=yes
backend-no-tls=yes
workers=1
log-level=INFO

When I do:

sudo nghttpx

This error is thrown:

28/Nov/2017:15:33:30 +0900 PID19518 [ERROR] shrpx_config.cc:1418 backend: ';' must not be used in pattern
28/Nov/2017:15:33:30 +0900 PID19518 [FATAL] shrpx.cc:1714 Failed to load configuration from /etc/nghttpx/nghttpx.conf

What is wrong with my nghttpx config?


Solution

  • Reading man page of nghttpx we see that --backend option supports the following structure:

    --backend=(<HOST>,<PORT>|unix:<PATH>)[;[<PATTERN>[:...]][[;<PARAM>]...]

    Since you have backend=127.0.0.0,9901;<PATTERN>, everything that follows ; should be a valid <PATTERN>. Upon further reading of the manual we see that it says:

    Since ";" and ":" are used as delimiter, must not contain these characters. Since ";" has special meaning in shell, the option value must be quoted.

    Now, looking at your error, it says:

    shrpx_config.cc:1418 backend: ';' must not be used in pattern

    Which indicates that you have used ; in a pattern, which is not allowed. This agrees with the manual excerpt above.

    So it seems that your issue is that you have one too many ; characters in your pattern. At the moment it is ;proto=h2, when it should be proto=h2. Try removing the redundant ; (i.e. it should read backend=127.0.0.0,9901;proto=h2) and see if that helps with the error you're getting.