Haproxy reverse proxy, headers, 2 domains

Greeting,

can someone please help with my issue.

I have an example.com domain that listens on an IP address and I have a CNAME example2.com on the same IP address.

when the user comes from the url example2.com, it preservs the url, but none of the links on the page still work, the page is empty only when it comes from example2.com

configuration:

frontend example.com
bind *:443 ssl crt /etc/haproxy/certs/ no-sslv3 no-tls-tickets
bind *:80
mode http
acl example2_com hdr(host) -i example2.com
default_backend example.com
http-after-response set-header Strict-Transport-Security “max-age=31536000; includeSubDomains”
http-request redirect scheme https unless { ssl_fc }
http-request set-header X-Forwarded-Proto https
http-request set-header FRONT_END_HTTPS on
use_backend example2_com if example2_com

backend example2_com
http-request set-header Host example.com
server example.com ip:port

backend example_com
server example.com ip:port

Open your browser development console and you will see what your problem is based on the errors you see there. Probably cross origin related nothing to do with haproxy.