Closed soapdog closed 7 years ago
Seems like the PR is merged! I'm gonna make a new remy release :) Then you can make a PR to sailor with this! 💃
Done! You can PR this to sailor now! :D
Merged in Remy as well _o/
PR sent https://github.com/sailorproject/sailor/pull/131 :D :D
Those using sailor to build API servers need some more advanced controls for dealing with HTTP headers. One common need is implementing CORS support so that the API server is able to respond to clients on different origins, this is all done through some juggling of HTTP headers.
To solve CORS, I have implemented a new function called
page:enable_cors()
which allows the developer to set all needed headers but to make this work, I also need to patch remy because the cgilua implementation there only outputs location headers and ignore all the rest.I have already sent a PR to remy fixing this and am waiting for feedback. Since this PR blocks the current CORS implementation on Xavante (but potentially not on Apache) I decided not to send the PR to sailor right now.
In the meanwhile, you can check the implementation here:
https://github.com/amora-labs/sailor/tree/enhancement-cors (on page.lua)
Cheers andre