Skip to content

ability to listen on IPv4 with graceful IPv6 #287

@mwcz

Description

@mwcz

Hello. We use ubi9/httpd-24 as a base for the Red Hat Offline Knowledge Portal.

We would like to be able to listen on IPv4 and IPv6, but gracefully handle cases where IPv6 is unavailable.

I began by adding Listen [::]:8080 to our custom config, mimir.conf. That worked, even when IPv6 is disabled with sysctl, however if the kernel is booted with ipv6.disable=1, then Apache will not launch because no IPv6 sockets can be claimed. On such systems, our product cannot run.

Next I tried adding Listen 8080 to our custom config. Apache wouldn't accept that because httpd.conf already claimed 8080.

The only workaround I could come up with so far is to override httpd.conf with a copy that has Listen 8080 and also override common.sh to comment out this sed:

sed -i -e 's/^Listen 80/Listen 0.0.0.0:8080/' ${HTTPD_MAIN_CONF_PATH}/httpd.conf

Would you be open to any of the following:

  • Listening on IPv4 + IPv6 (if available) by default: sed -i -e 's/^Listen 80/Listen 8080/' ${HTTPD_MAIN_CONF_PATH}/httpd.conf
  • Having the startup scripts detect IPv6 (/proc/net/if_inet6) and emit either Listen 8080 or Listen 0.0.0.0:8080 accordingly.

Since the only workaround we have right now involves overriding two core files, we're happy with anything that's less hacky and fragile, that allows us to listen on IPv4 and IPv6.

Side note: yes, we could listen on another port in our custom config, ie Listen 8081, and that should work, but it would require updating our docs, and it be a big problem for all the existing deployments of RHOKP that route to 8080.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions