Skip to content

Links with IP redirects don't work with IPv6 (HTTP Code 500) #2535

@matbad

Description

@matbad

Shlink version

v4.6.0

PHP version

8.4

How do you serve Shlink

Self-hosted Apache

Database engine

MariaDB

Database version

10.11.14

Current behavior

First of all, thank you for this tool and all the work done so far.

"An unexpected error occurred" when Short URL is requested.

Error in shlink log

Shlink.ERROR - Shlinkio\Shlink\Core\Exception\InvalidIpFormatException: Provided IP xxxx:xxxx:xxxx::xxxx does not have the right format. Expected X.X.X.X in PATH/module/Core/src/Exception/InvalidIpFormatException.php:13

Apache Log shows a 500 status code.

Expected behavior

Redirect properly:
Short URL -> (default) Long URL
Short URL -> alternative Long URL setup in redirect rule.

Minimum steps to reproduce

  1. Create a Short URL
  2. Create dynamic redirect rule, based on IP. (no matter IPv6 or IPv4)
  3. Try connecting via curl with curl -4I https://short.url and curl -6I https://short.url
  4. IPv4 (curl -4) works. IPv6 (curl -6) does not work

EDIT: added more context on creation of dynamic redirect rule

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    Status

    No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions