I have some actions that respond with static content. I also need them cached on client.
Similar question was asked in the past for rails 2
Is it possible to omit set-cookie header from the response in Rails 2.3?
The Set-Cookie HTTP response header is used to send a cookie from the server to the user agent, so that the user agent can send it back to the server later. To send multiple cookies, multiple Set-Cookie headers should be sent in the same response.
Creating cookies. After receiving an HTTP request, a server can send one or more Set-Cookie headers with the response.
A cookie is an HTTP request header i.e. used in the requests sent by the user to the server.
The Set-Cookie header is sent by the server in response to an HTTP request, which is used to create a cookie on the user's system. The Cookie header is included by the client application with an HTTP request sent to a server, if there is a cookie that has a matching domain and path.
Use the built in option.
env['rack.session.options'][:skip] = true
or
request.session_options[:skip] = true
or in older versions use this
env['rack.session.options'][:defer] = true
or
request.session_options[:defer] = true
You can find the documentation for it here http://rack.rubyforge.org/doc/Rack/Session/Abstract/ID.html
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With