README.md in immunio-1.1.7 vs README.md in immunio-1.1.10

- old
+ new

@@ -37,10 +37,29 @@ gem immunio', group: :production ``` You can also modify the secret and key for different environments to report to different apps, or you can disable the agent by setting `agent_enabled: false` in the configuration or `IMMUNIO_AGENT_ENABLED=0` in the environment. + +### Unicorn configuration + +In order for the agent to function correctly in a pre-forked environment, use the `Immunio.reset!` method. +For example, in your `config/unicorn.rb`: + +``` +after_fork do |server, worker| + Signal.trap 'TERM' do + puts 'Unicorn worker intercepting TERM and doing nothing. Wait for master to send QUIT' + end + + defined?(ActiveRecord::Base) and ActiveRecord::Base.establish_connection + + Immunio.reset! +end +``` + + ## Handling blocked requests By default, Immunio will return a plain text *403 Forbidden* response whenever it blocks a request for security reasons. To customize this behavior, use the `Immunio.blocked_app` option, which should be a valid [Rack application](http://rack.github.io/): @@ -52,9 +71,10 @@ { 'Content-Type' => 'text/html' }, ActionController::DataStreaming::FileBody.new('public/403.html') ] end ``` + ## Authentication API If you're using [Devise](https://github.com/plataformatec/devise) or [Authlogic](https://github.com/binarylogic/authlogic), Immunio will automatically hook into your authentication system to protect you against attacks.