Mattermost, Inc.

Regular Expression for CORS configuration

Hello! Does anyone knows, can I set regular expression for CORS config, something like (https?:\/\/localhost:[0-9]{1,5})|(https?:\/\/([^\.\\]*\.)?mysuper\.mysite\.mydomain)$ ? I read Configuration Settings and cannot understand, it is possible? If itsn’t possible, maybe exists issue for this feature or some solution with nginx proxy? Is not that popular and useful feature?

I found this CORS realization -

for _, allowed := range strings.Split(allowedOrigins, " ") {
if allowed == origin {
return true
So, may be for somebody interested realize feaure with pattern matching? Unfortunately, I’m not good in Go programming.

Also, I think, may be it is not security do it for production? But we want pattern matching only for subdomain.