Enable haproxy CORS support for https


I have no experience in managing and configuring haproxy, but I need to quickly adapt the existing haproxy configuration, which currently looks like this:

frontend rpc-lcd-frontend
bind A.B.C.D:443 ssl crt /etc/ssl/certs/cert.pem
acl rpc ssl_fc_sni service1.domain.com
acl lcd ssl_fc_sni service2.domain.com
acl connector ssl_fc_sni connector.domain.com

use_backend service1.domain.com if rpc
use_backend service2.domain.com if lcd
use_backend connector.domain.com if connector

backend rpc.domain.com
server server1 A.B.C.D:26657

backend lcd.domain.com
server server1 A.B.C.D:1317

backend connector.domain.com
server server1 A.B.C.D:8124

I need to enable CORS support in this configuration, but only for the connector.domain.com domain. At the same time, traffic must be carried out via the HTTPS protocol.
I found many examples of how to enable CORS, but they require the http mode.
How to do this?

The use of ssl_fc_sni is wrong here, you need to use hdr(host) instead.

Correct, to modify HTTP headers you need to be in HTTP mode, there is no way around that.