Haproxy 2.2 ( CORS proper Implementation)

Hi Team,

We are trying to use standard implementation of CORS ( cross origin shared resources ) with HAProxy 2.2 , after implementation we observed that this is working but we will have to enter all subdomain and domain manually. We want to allow wild card expression so that manual subdomain entries need not to enter every time for same domain.

haproxy -v
2.2.10
lua version : 5.3.4
copy below file and add in haprox.conf

Will appreciate your expert help to achieve this.

To achieve wild card support I tried below option but nothing work , kindly suggest right way.
http-request lua.cors “*”, " .example.com", "" --not work

http-request lua.cors “", " ..example.com”, “*” --not work

----------------------Sample added lines in Configuration files and working with subdomain entries -----------------------

global
lua-load /etc/haproxy/cors.lua

frontend https_frontend
http-request capture req.hdr(Origin) len 40
http-request lua.cors “", “help.example.com,admin.example.com,hire.example.com”, "

backend dashboard
http-response lua.cors

Regards
Anupam