1

I want to do the equivalent of this in haproxy to allow CORS for any server in my domain. By default CORS only does null, star or a single URL. Is that possible?

 SetEnvIf Origin "^(.*\.bebop\.co)$" ORIGIN_SUB_DOMAIN=$1
 Header set Access-Control-Allow-Origin "%{ORIGIN_SUB_DOMAIN}e" env=ORIGIN_SUB_DOMAIN

I've already added the Access-Control-Allow-Credentials and set it to true so just need that one more piece. Thanks much.

2

Ok, I think I figured some things out that answer my question. The equivelant of above is to add in the frontend section:

frontend
...
...
# CORS Config Capture
capture request header origin len 50

and on the backend:

backend
...
...
http-response set-header Access-Control-Allow-Credentials true
http-response set-header Access-Control-Allow-Origin %[capture.req.hdr(0)]

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.