How do I add a module to passenger nginx?

Hi

We have problem with our current setup of nginx’s CORS setting. We need to be returning CORS headers for all status codes but the add_header directive only applies to 200, 204, 301and 302 statuses.

I would like to add this nginx module to our server: http://wiki.nginx.org/NginxHttpHeadersMoreModule.

How do we go about doing this on our stack?

Thanks for getting in touch with us. The best way is to create a deploy hook that will run the scripts manually on a server, to ensure that they go through and work. We can help you to create the deploy hook if you wish so.

Thanks for the quick reply! Any help you could do would be amazing.

I created a snippet that automates the addition of a module on your servers: http://pastebin.com/raw.php?i=QAcZ67EX. You will just need to feed it the URL to your module, through an environment variable called MODULE_URL. In your case, this URL will be https://github.com/openresty/headers-more-nginx-module/archive/v0.25.tar.gz.

The deploy hook will run on any newly built servers (hence the apply_during: build_only), so if you need to apply it to an existing stack, you will need to remove that for the first run. To avoid it running on existing servers thereafter, you can re-add that condition.

Please see the following link for additional information: http://community.cloud66.com/articles/add-modules-to-nginx

Please let me know if you have any questions about this.

Thanks, that worked wonderfully!

You must be logged in to answer this question