Skip to content

Conversation

@NickMRamirez
Copy link
Collaborator

With this change, the module will now intercept preflight requests (OPTIONS requests) and return an immediate reply without contacting the backend servers. This is only supported in HAProxy version 2.2 and above. In older versions, it reverts to the previous behavior of forwarding the preflight request to the backend server and then attaching the CORS headers on the response on its way back out.

Note that this changes the syntax you must use in the haproxy.cfg. Now, all needed info is collected on the request action, saved in a table that is stored in a private variable, and then retrieved during the response.

example:

# Invoke the CORS service on the request to capture the Origin header
http-request lua.cors "GET,PUT,POST", "localhost"

# Invoke the CORS service on the response to add CORS headers
http-response lua.cors

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants