'Haproxy, how to use case insensitive redirects map?

So, I want redirects like these to work:

  • example.com/QWER -> example.com/qwer
  • example.com/Qwer -> example.com/qwer
  • example.com/QwEr -> example.com/qwer

What I have tried:

http-request redirect location %[path,lower,map_str(/usr/local/etc/haproxy/website-redirects.map)] code 301 if { path,lower,map_str(/usr/local/etc/haproxy/website-redirects.map) }

And different combinations: with "map_reg", without "lower", using -i etc.

Thanks in advance!



Solution 1:[1]

Ok so you can remove the guild id simply by

# Do a if id in data.keys() b4 to make sure there wont be a KeyError
with open('json/data.json','r+') as f:  # u don't need the f"" or __file__
    data = json.load(f)
    del data[str(ctx.guild.id)]
    # save json do bomb stuff

Now deleting a specific command

#Load json like the previous snippet
if cmd in data[str(ctx.guild.id)]:
    del data[str(ctx.guild.id)][data[str(ctx.guild.id)].index(cmd)]
    #save json

and its also advisable to use a db instead of json(its very useful for seldom changed data) but if its a small project json would do fine

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 RandomGuy