Reference

get map

Test whether an input matches an entry in a map file.

Description Jump to heading

This command returns a result that indicates whether an input matches an entry in a map file. This is useful for debugging maps.

Examples Jump to heading

Pass the map ID and an input string to get map to test whether the string matches any keys.

bash
/cart/ cart_api
/reviews/ reviews_api
bash
/cart/ cart_api
/reviews/ reviews_api

Assume we have this map file:

Test whether the input string /reviews/war-and-peace/1 matches any keys:

bash
echo "get map #0 /reviews/war-and-peace/1" | \
sudo socat stdio tcp4-connect:127.0.0.1:9999
bash
echo "get map #0 /reviews/war-and-peace/1" | \
sudo socat stdio tcp4-connect:127.0.0.1:9999
output
bash
type=beg, case=sensitive, found=yes, idx=tree, key="/reviews/", value="reviews_api", type="str"
output
bash
type=beg, case=sensitive, found=yes, idx=tree, key="/reviews/", value="reviews_api", type="str"

The result indicates that a match was found using the type beg, which means begins with. It matched the key /reviews/.

See also Jump to heading

If this page was useful, please, Leave the feedback.

© 2023 HAProxy Technologies, LLC. All Rights Reserved
Manage Cookie Preferences