{"id":271529,"date":"2016-01-03T05:04:04","date_gmt":"2016-01-03T02:04:04","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=271529"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=271529","title":{"rendered":"\u0417\u0430\u0449\u0438\u0449\u0430\u0435\u043c Revel \u043e\u0442 CSRF \u0430\u0442\u0430\u043a"},"content":{"rendered":"<p>       <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/8ae\/57a\/b1d\/8ae57ab1d38643479f5e281abfe638cb.png\"\/><\/p>\n<p>  \u041f\u043e\u0441\u043b\u0435 \u0442\u043e\u0433\u043e \u043a\u0430\u043a <a href=\"http:\/\/habrahabr.ru\/post\/162115\/\">\u043d\u0430\u0438\u0433\u0440\u0430\u043b\u0438\u0441\u044c \u0441 Revel<\/a> \u0438 \u043f\u043e\u043d\u044f\u043b\u0438 \u0447\u0442\u043e \u044d\u0442\u043e \u0437\u0430 \u0447\u0443\u0434\u0438\u043a, \u043f\u043e\u0440\u0430 \u0443\u0447\u0438\u0442\u044c\u0441\u044f \u0433\u043e\u0442\u043e\u0432\u0438\u0442\u044c \u0435\u0433\u043e \u043a production \u0432 \u0447\u0430\u0441\u0442\u0438 \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e\u0441\u0442\u0438. \u0414\u0430\u043d\u043d\u0430\u044f \u0437\u0430\u043c\u0435\u0442\u043a\u0430 \u0432\u043f\u043e\u043b\u043d\u0435 \u043c\u043e\u0436\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0432 \u043b\u044e\u0431\u043e\u043c \u0432\u0435\u0431-\u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0438, \u043d\u043e \u0440\u0430\u0441\u0441\u043a\u0430\u0437\u044b\u0432\u0430\u0442\u044c \u0431\u0443\u0434\u0443 \u043d\u0430 \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u043f\u0440\u043e\u0441\u0442\u043e\u0433\u043e \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u043d\u0430 Revel.<br \/>  <a name=\"habracut\"><\/a><br \/>  \u0412\u043e\u043e\u0431\u0449\u0435\u043c \u0441\u0443\u0442\u044c \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b \u0437\u0430\u043a\u043b\u044e\u0447\u0430\u0435\u0442\u0441\u044f \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442 \u043a\u043b\u0430\u0441\u0441 \u0430\u0442\u0430\u043a \u0432 \u0418\u043d\u0442\u0435\u0440\u043d\u0435\u0442\u0435 \u0438\u043c\u0435\u043d\u0443\u0435\u043c\u044b\u0435 Cross-Site Request Forgery (\u0441\u043e\u043a\u0440. CSRF). \u0415\u0441\u043b\u0438 \u0432\u044b \u043d\u0435 \u0437\u043d\u0430\u043a\u043e\u043c\u044b \u0441 \u043d\u0438\u043c\u0438, \u0442\u043e \u043f\u0440\u043e\u0441\u044c\u0431\u0430 \u043e\u0431\u0440\u0430\u0442\u0438\u0442\u044c \u0441\u0432\u043e\u0435 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435. \u041f\u0440\u0438\u0432\u0435\u0434\u0443 \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u0443\u044e \u0432\u044b\u0434\u0435\u0440\u0436\u043a\u0443 \u0438\u0437 \u0412\u0438\u043a\u0438:<\/p>\n<blockquote><p>CSRF \u2014 \u0432\u0438\u0434 \u0430\u0442\u0430\u043a \u043d\u0430 \u043f\u043e\u0441\u0435\u0442\u0438\u0442\u0435\u043b\u0435\u0439 \u0432\u0435\u0431-\u0441\u0430\u0439\u0442\u043e\u0432, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0449\u0438\u0439 \u043d\u0435\u0434\u043e\u0441\u0442\u0430\u0442\u043a\u0438 \u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b\u0430 HTTP. \u0415\u0441\u043b\u0438 \u0436\u0435\u0440\u0442\u0432\u0430 \u0437\u0430\u0445\u043e\u0434\u0438\u0442 \u043d\u0430 \u0441\u0430\u0439\u0442, \u0441\u043e\u0437\u0434\u0430\u043d\u043d\u044b\u0439 \u0437\u043b\u043e\u0443\u043c\u044b\u0448\u043b\u0435\u043d\u043d\u0438\u043a\u043e\u043c, \u043e\u0442 \u0435\u0451 \u043b\u0438\u0446\u0430 \u0442\u0430\u0439\u043d\u043e \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0437\u0430\u043f\u0440\u043e\u0441 \u043d\u0430 \u0434\u0440\u0443\u0433\u043e\u0439 \u0441\u0435\u0440\u0432\u0435\u0440 (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043d\u0430 \u0441\u0435\u0440\u0432\u0435\u0440 \u043f\u043b\u0430\u0442\u0451\u0436\u043d\u043e\u0439 \u0441\u0438\u0441\u0442\u0435\u043c\u044b), \u043e\u0441\u0443\u0449\u0435\u0441\u0442\u0432\u043b\u044f\u044e\u0449\u0438\u0439 \u043d\u0435\u043a\u0443\u044e \u0432\u0440\u0435\u0434\u043e\u043d\u043e\u0441\u043d\u0443\u044e \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u044e (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043f\u0435\u0440\u0435\u0432\u043e\u0434 \u0434\u0435\u043d\u0435\u0433 \u043d\u0430 \u0441\u0447\u0451\u0442 \u0437\u043b\u043e\u0443\u043c\u044b\u0448\u043b\u0435\u043d\u043d\u0438\u043a\u0430). \u0414\u043b\u044f \u043e\u0441\u0443\u0449\u0435\u0441\u0442\u0432\u043b\u0435\u043d\u0438\u044f \u0434\u0430\u043d\u043d\u043e\u0439 \u0430\u0442\u0430\u043a\u0438 \u0436\u0435\u0440\u0442\u0432\u0430 \u0434\u043e\u043b\u0436\u043d\u0430 \u0431\u044b\u0442\u044c \u0430\u0443\u0442\u0435\u043d\u0442\u0438\u0444\u0438\u0446\u0438\u0440\u043e\u0432\u0430\u043d\u0430 \u043d\u0430 \u0442\u043e\u043c \u0441\u0435\u0440\u0432\u0435\u0440\u0435, \u043d\u0430 \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0437\u0430\u043f\u0440\u043e\u0441, \u0438 \u044d\u0442\u043e\u0442 \u0437\u0430\u043f\u0440\u043e\u0441 \u043d\u0435 \u0434\u043e\u043b\u0436\u0435\u043d \u0442\u0440\u0435\u0431\u043e\u0432\u0430\u0442\u044c \u043a\u0430\u043a\u043e\u0433\u043e-\u043b\u0438\u0431\u043e \u043f\u043e\u0434\u0442\u0432\u0435\u0440\u0436\u0434\u0435\u043d\u0438\u044f \u0441\u043e \u0441\u0442\u043e\u0440\u043e\u043d\u044b \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043d\u0435 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043f\u0440\u043e\u0438\u0433\u043d\u043e\u0440\u0438\u0440\u043e\u0432\u0430\u043d \u0438\u043b\u0438 \u043f\u043e\u0434\u0434\u0435\u043b\u0430\u043d \u0430\u0442\u0430\u043a\u0443\u044e\u0449\u0438\u043c \u0441\u043a\u0440\u0438\u043f\u0442\u043e\u043c.<\/p><\/blockquote>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/2f5\/c70\/cdb\/2f5c70cdbc4c43499a8f543960edb370.png\"\/><i>\u0440\u0438\u0441. \u041f\u0440\u0438\u043c\u0435\u0440 CSRF-\u0430\u0442\u0430\u043a\u0438 \u043d\u0430 \u0441\u0430\u0439\u0442 \u0431\u0430\u043d\u043a\u0430<\/i><\/p>\n<p>  \u0420\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0443\u044e \u0442\u0430\u043a\u0436\u0435 \u043f\u0440\u043e\u0447\u0438\u0442\u0430\u0442\u044c <a href=\"http:\/\/habrahabr.ru\/post\/235247\/\">\u0442\u0438\u043f\u0438\u0447\u043d\u044b\u0435 \u043e\u0448\u0438\u0431\u043a\u0438 \u043f\u0440\u0438 \u0437\u0430\u0449\u0438\u0442\u0435 \u0441\u0430\u0439\u0442\u043e\u0432 \u043e\u0442 CSRF-\u0430\u0442\u0430\u043a<\/a>.<\/p>\n<p>  \u041d\u0430 \u0441\u0432\u0435\u0436\u0435\u043c \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0438 Revel CSRF-\u0430\u0442\u0430\u043a\u0438 \u0443\u0441\u043f\u0435\u0448\u043d\u043e \u043f\u0440\u043e\u0445\u043e\u0434\u044f\u0442, \u0442.\u043a. \u0437\u0430\u0449\u0438\u0442\u044b \u0438\u0437\u043d\u0430\u0447\u0430\u043b\u044c\u043d\u043e \u043d\u0435\u0442. <\/p>\n<h4>\u0418\u0442\u0430\u043a, \u043d\u0430\u0447\u043d\u0435\u043c \u043a\u0443\u0442\u0438\u0442\u044c \u0441 \u0441\u0443\u0441\u043b\u0438\u043a\u043e\u043c \u2014 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430 \u0437\u0430\u0449\u0438\u0442\u044b<\/h4>\n<p>  \u0422\u043e\u0432\u0430\u0440\u0438\u0449\u0438 \u0438\u0437 Revel \u043f\u0440\u0435\u0434\u043b\u0430\u0433\u0430\u044e\u0442 \u043d\u0430\u043c \u0443\u0436\u0435 \u0433\u043e\u0442\u043e\u0432\u044b\u0439 \u043c\u043e\u0434\u0443\u043b\u044c \u0434\u043b\u044f \u0437\u0430\u0449\u0438\u0442\u044b <a href=\"https:\/\/github.com\/revel\/modules\/tree\/master\/csrf\/app\">github.com\/revel\/modules\/tree\/master\/csrf\/app<\/a> \u0441 \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u0435\u0439 \u043f\u043e \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0435:  <\/p>\n<blockquote><p>CsrfFilter enables CSRF request token creation and verification.<\/p>\n<p>  Usage:<br \/>  1) Add `csrf.CsrfFilter` to the app&#8217;s filters (it must come after the revel.SessionFilter).<br \/>  2) Add CSRF fields to a form with the template tag `{{ csrftoken. }}`. The filter adds a function closure to the `RenderArgs` that can pull out the secret and make the token as-needed, caching the value in the request. Ajax support provided through the `X-CSRFToken` header.  <\/p><\/blockquote>\n<p>  \u0421\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u0432\u0441\u0435 \u043e\u043a! \u0414\u043e\u0431\u0430\u0432\u0438\u043b \u0444\u0438\u043b\u044c\u0442\u0440 \u0432 init.go \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u043f\u043e \u044d\u0442\u043e\u0439 \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u0438\u2026 \u0418 \u043e\u043d\u043e \u043d\u0435 \u0437\u0430\u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442, \u0435\u0441\u043b\u0438 \u0442\u0432\u043e\u0439 \u0431\u0440\u0430\u0443\u0437\u0435\u0440 \u043d\u0435 \u043f\u043e\u0441\u044b\u043b\u0430\u0435\u0442 \u0432 <a href=\"https:\/\/ru.wikipedia.org\/wiki\/HTTP_refere\">\u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043a\u0435 Referer<\/a>. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u043f\u0440\u043e\u043f\u0443\u0441\u0442\u0438\u043c \u0432\u0441\u044e \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0443 \u044d\u0442\u043e\u0433\u043e \u0444\u0438\u043b\u044c\u0442\u0440\u0430 \u0432 \u044d\u0442\u043e\u0439 \u0437\u0430\u043c\u0435\u0442\u043a\u0435 \u0438 \u043f\u0435\u0440\u0435\u0439\u0434\u0435\u043c \u043a \u0430\u043b\u044c\u0442\u0435\u0440\u043d\u0430\u0442\u0438\u0432\u043d\u043e\u043c\u0443 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u0443.<\/p>\n<p>  \u041e\u0434\u0438\u043d \u0438\u0437 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u043e\u0432, \u043f\u0440\u0435\u0434\u043b\u043e\u0436\u0435\u043d\u043d\u044b\u0439 <a href=\"https:\/\/github.com\/revel\/revel\/issues\/788\">\u0432 \u0431\u0430\u0433-\u0442\u0440\u0435\u043a\u0435\u0440\u0435 Revel \u043d\u0430 \u0442\u0435\u043c\u0443 CSRF<\/a> \u0431\u044b\u043b \u043f\u0440\u043e\u0435\u043a\u0442: <a href=\"https:\/\/github.com\/cbonello\/revel-csrf\">github.com\/cbonello\/revel-csrf<\/a>. \u041f\u0440\u0438\u043d\u0446\u0438\u043f \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0438 \u043f\u0440\u043e\u0441\u0442:<\/p>\n<p>  \u0421\u043d\u0430\u0447\u0430\u043b\u0430 \u0432\u044b\u043a\u0430\u0447\u0438\u0432\u0430\u0435\u043c \u0432\u0441\u0435 \u043a \u0441\u0435\u0431\u0435 \u0432 GOPATH  <\/p>\n<pre><code class=\"bash\">go get github.com\/cbonello\/revel-csrf <\/code><\/pre>\n<p>  \u0414\u0430\u043b\u044c\u0448\u0435 \u0432 \/app\/init.go \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u0441\u0442\u0440\u043e\u0447\u043a\u0443 \u0432 import \u0441\u0435\u043a\u0446\u0438\u044e:  <\/p>\n<pre><code class=\"go\">import ( \t&quot;github.com\/cbonello\/revel-csrf&quot; \t&quot;github.com\/revel\/revel&quot; ) <\/code><\/pre>\n<p>  \u0410 \u0432 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 init() \u0432 \u0442\u043e\u043c \u0436\u0435 \u0444\u0430\u0439\u043b\u0435 \/app\/init.go \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u044d\u0442\u043e\u0442 \u0444\u0438\u043b\u044c\u0442\u0440:  <\/p>\n<pre><code class=\"go\">func init() { \t\/\/ Filters is the default set of global filters. \trevel.Filters = []revel.Filter{ \t\t... \t\trevel.SessionFilter,           \/\/ Restore and write the session cookie. \t\trevel.FlashFilter,             \/\/ Restore and write the flash cookie. \t\tHeaderFilter,                  \/\/ Add some security based headers \t\tcsrf.CSRFFilter,               \/\/ CSRF prevention. &lt;---------------------------- \t\trevel.ValidationFilter,        \/\/ Restore kept validation errors and save new ones from cookie. \t\t... \t}         ... } <\/code><\/pre>\n<p>  \u0423\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430 \u043f\u043e\u0447\u0442\u0438 \u0433\u043e\u0442\u043e\u0432\u0430! \u0422\u0435\u043f\u0435\u0440\u044c \u0432\u0441\u0435 \u043c\u0435\u0442\u043e\u0434\u044b \u043a\u0440\u043e\u043c\u0435 GET, HEAD, OPTIONS, TRACE, WS \u0441\u0447\u0438\u0442\u0430\u044e\u0442\u0441\u044f \u00ab\u043d\u0435\u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u044b\u043c\u0438\u00bb \u0438 \u043f\u0440\u0438 \u043e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0438\u0438 \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u0433\u043e \u0442\u043e\u043a\u0435\u043d\u0430 \u0432 \u0437\u0430\u043f\u0440\u043e\u0441\u0435 \u0431\u0443\u0434\u0435\u0442 403 \u043e\u0448\u0438\u0431\u043a\u0430.<\/p>\n<h4>\u041a\u0430\u043a \u043f\u0435\u0440\u0435\u0434\u0430\u0432\u0430\u0442\u044c \u0442\u043e\u043a\u0435\u043d<\/h4>\n<p>  \u041e\u0441\u043d\u043e\u0432\u043d\u044b\u0435 \u043d\u0435\u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u044b\u0435 \u0437\u0430\u043f\u0440\u043e\u0441\u044b \u0444\u043e\u0440\u043c\u0438\u0440\u0443\u044e\u0442\u0441\u044f \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0432\u0435\u0431-\u0444\u043e\u0440\u043c. \u0421\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u043b\u043e\u0433\u0447\u0438\u043d\u043e \u0442\u0435\u043f\u0435\u0440\u044c \u0432 \u043a\u0430\u0436\u0434\u0443\u044e \u0444\u043e\u0440\u043c\u0443 \u0432\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u0441\u043a\u0440\u044b\u0442\u043e\u0435 \u043f\u043e\u043b\u0435, \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0449\u0438\u0439 \u0442\u043e\u043a\u0435\u043d:  <\/p>\n<pre><code class=\"html\">&lt;form id=&quot;login-form&quot; class=&quot;form-vertical&quot; action=&quot;{{url &quot;App.ConfirmLogin&quot;}}&quot; method=&quot;post&quot;&gt;   &lt;input type=&quot;hidden&quot; name=&quot;csrf_token&quot; value=&quot;{{.csrf_token }}&quot;&gt;   ... &lt;\/form&gt; <\/code><\/pre>\n<p>  \u0414\u043b\u044f \u0443\u043f\u0440\u043e\u0449\u0435\u043d\u0438\u044f \u043c\u043e\u0436\u043d\u043e \u0432\u0437\u044f\u0442\u044c \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u0434\u043b\u044f \u0448\u0430\u0431\u043b\u043e\u043d\u0438\u0437\u0430\u0442\u043e\u0440\u0430 \u0438\u0437 \u043c\u043e\u0434\u0443\u043b\u044f \u043e\u0442 \u043a\u043e\u043c\u0430\u043d\u0434\u044b Revel.<\/p>\n<p>  \u0411\u043e\u043b\u044c\u0448\u0430\u044f \u0447\u0430\u0441\u0442\u044c \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0439 \u0442\u0430\u043a \u0438 \u0440\u0435\u0448\u0430\u0435\u0442\u0441\u044f \u2014 \u0432\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u043d\u0438\u0435\u043c \u0441\u043a\u0440\u044b\u0442\u043e\u0433\u043e \u043f\u043e\u043b\u044f \u0432 \u0432\u0435\u0431-\u0444\u043e\u0440\u043c\u044b. \u041d\u043e \u0435\u0441\u0442\u044c \u043a\u0430\u0442\u0435\u0433\u043e\u0440\u0438\u044f \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0439, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043d\u0435 \u0442\u0440\u0435\u0431\u0443\u044e\u0442 \u043e\u0442\u043f\u0440\u0430\u0432\u043a\u0438 \u0432\u0435\u0431-\u0444\u043e\u0440\u043c\u044b, \u043d\u043e \u044f\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u043d\u0435\u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u044b\u043c\u0438 \u0441 \u0442\u043e\u0447\u043a\u0438 \u0437\u0440\u0435\u043d\u0438\u044f \u0431\u0438\u0437\u043d\u0435\u0441-\u043b\u043e\u0433\u0438\u043a\u0438. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440: \u0432\u044b\u0445\u043e\u0434 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u043f\u043e \u0441\u0441\u044b\u043b\u043a\u0435 \/logout. \u041f\u0440\u043e\u0432\u0435\u0441\u0442\u0438 \u0430\u0442\u0430\u043a\u0443 \u043f\u043e \u0442\u0430\u043a\u043e\u043c\u0443 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044e \u043e\u0447\u0435\u043d\u044c \u043f\u0440\u043e\u0441\u0442\u043e, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0443 \u0442\u0430\u043a\u043e\u0433\u043e \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043f\u0435\u0440\u0435\u0432\u0435\u0441\u0442\u0438 \u0441 \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e\u0433\u043e GET \u043c\u0435\u0442\u043e\u0434\u0430 \u043d\u0430 POST \u043c\u0435\u0442\u043e\u0434, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0434\u043b\u044f \u043d\u0430\u0441 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043d\u0435\u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u044b\u043c.<\/p>\n<p>  \u0414\u043b\u044f \u0442\u0430\u043a\u0438\u0445 \u0441\u043b\u0443\u0447\u0430\u0435\u0432, \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0445\u043e\u0440\u043e\u0448\u0443\u044e \u043e\u0431\u0435\u0440\u0442\u043a\u0443 \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 ajax \u0432 RoR: <a href=\"https:\/\/github.com\/rails\/jquery-ujs\">github.com\/rails\/jquery-ujs<\/a><\/p>\n<p>  \u0423\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u043c \u043a \u0441\u0435\u0431\u0435 \u0432 \u043f\u0440\u043e\u0435\u043a\u0442 \u0447\u0435\u0440\u0435\u0437 Bower:  <\/p>\n<pre><code class=\"bash\">$ bower install jquery-ujs --save <\/code><\/pre>\n<p>  \u0418 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0438\u043c \u0435\u0433\u043e \u043a \u0441\u0435\u0431\u0435 \u0432 \u0448\u0430\u0431\u043b\u043e\u043d. \u041f\u0438\u0441\u0430\u0442\u044c \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u043e\u0441\u0442\u0438 \u0442\u0443\u0442 \u043d\u0435 \u0431\u0443\u0434\u0443 \u043a\u0430\u043a \u044f \u0434\u0435\u043b\u0430\u044e, \u0443 \u043c\u0435\u043d\u044f \u0441\u0431\u043e\u0440\u043a\u0430 \u0447\u0435\u0440\u0435\u0437 Grunt \u0438 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 \u0443\u0436\u0435 \u0441\u043e\u0431\u0440\u0430\u043d\u043d\u044b\u0445 \u0441\u043a\u0440\u0438\u043f\u0442\u043e\u0432. \u041d\u0430\u0434\u0435\u044e\u0441\u044c \u0443 \u0442\u0435\u0431\u044f \u044d\u0442\u043e \u0442\u0440\u0443\u0434\u0430 \u043d\u0435 \u0441\u043e\u0441\u0442\u0430\u0432\u0438\u0442 \ud83d\ude09<\/p>\n<p>  \u041f\u043e\u0441\u043b\u0435 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0435\u0449\u0435 \u043f\u0430\u0440\u0443 \u0441\u0442\u0440\u043e\u043a \u0432 \u0448\u0430\u043f\u043a\u0443, \u0447\u0442\u043e\u0431\u044b \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430 \u043f\u043e\u043d\u044f\u043b\u0430 \u043a\u0430\u043a\u043e\u0439 \u0442\u043e\u043a\u0435\u043d \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0442\u044c:  <\/p>\n<pre><code class=\"html\">&lt;!DOCTYPE html&gt; &lt;html lang=&quot;ru&quot;&gt; &lt;head&gt;   ...   &lt;meta name=&quot;csrf-token&quot; content=&quot;{{.csrf_token}}&quot;&gt;   &lt;meta name=&quot;csrf-param&quot; content=&quot;csrf_token&quot;&gt;   ... &lt;\/head&gt; ... <\/code><\/pre>\n<p>  \u041f\u043e\u0441\u043b\u0435 \u044d\u0442\u043e\u0433\u043e \u0441\u0442\u043e\u0438\u0442 \u0432\u043a\u043b\u044e\u0447\u0438\u0442\u044c \u0435\u0449\u0435 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0443 Ajax \u0443 \u0444\u0438\u043b\u044c\u0442\u0440\u0430 (\u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u0432\u044b\u043a\u043b\u044e\u0447\u0435\u043d\u0430), \u0434\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0432 \u0444\u0430\u0439\u043b \/conf\/app.conf \u043d\u0443\u0436\u043d\u043e \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0435:  <\/p>\n<pre><code>csrf.ajax = true csrf.token.length = 64 <\/code><\/pre>\n<p>  \u0412\u0442\u043e\u0440\u0430\u044f \u0441\u0442\u0440\u043e\u0447\u043a\u0430 \u0442\u0443\u0442 \u0438\u0437\u043c\u0435\u043d\u044f\u0435\u0442 \u0434\u043b\u0438\u043d\u0443 \u0442\u043e\u043a\u0435\u043d\u0430, \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u043e\u043d\u0430 \u0432\u0441\u0435\u0433\u043e 32 \u0441\u0438\u043c\u0432\u043e\u043b\u0430. \u0414\u043b\u0438\u043d\u0430 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0432 \u0434\u0438\u0430\u043f\u0430\u0437\u043e\u043d\u0435 \u043e\u0442 32 \u0434\u043e 512 \u0441\u0438\u043c\u0432\u043e\u043b\u043e\u0432.<\/p>\n<p>  \u0415\u0441\u043b\u0438 \u0432\u0441\u0435 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u043e \u0432\u0435\u0440\u043d\u043e, \u0442\u043e \u0442\u0435\u043f\u0435\u0440\u044c \u043c\u043e\u0436\u043d\u043e \u0434\u0435\u043b\u0430\u0442\u044c \u0442\u0430\u043a\u0438\u0435 \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u044b\u0435 \u0441\u0441\u044b\u043b\u043a\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0431\u0443\u0434\u0443\u0442 \u0434\u0435\u043b\u0430\u0442\u044c \u0437\u0430\u043f\u0440\u043e\u0441 POST \u043c\u0435\u0442\u043e\u0434\u043e\u043c:  <\/p>\n<pre><code class=\"html\">&lt;a href=&quot;{{url &quot;App.Logout&quot;}}&quot; data-method=&quot;post&quot;&gt;\u0412\u044b\u0445\u043e\u0434&lt;\/a&gt; <\/code><\/pre>\n<p>  \u041d\u0430 \u044d\u0442\u043e\u043c \u0443 \u043c\u0435\u043d\u044f \u0432\u0441\u0451. \u0421\u043f\u0430\u0441\u0438\u0431\u043e \u0437\u0430 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435!               <\/p>\n<div class=\"clear\"><\/div>\n<p> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"http:\/\/habrahabr.ru\/post\/274457\/\"> http:\/\/habrahabr.ru\/post\/274457\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>       <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/8ae\/57a\/b1d\/8ae57ab1d38643479f5e281abfe638cb.png\"\/><\/p>\n<p>  \u041f\u043e\u0441\u043b\u0435 \u0442\u043e\u0433\u043e \u043a\u0430\u043a <a href=\"http:\/\/habrahabr.ru\/post\/162115\/\">\u043d\u0430\u0438\u0433\u0440\u0430\u043b\u0438\u0441\u044c \u0441 Revel<\/a> \u0438 \u043f\u043e\u043d\u044f\u043b\u0438 \u0447\u0442\u043e \u044d\u0442\u043e \u0437\u0430 \u0447\u0443\u0434\u0438\u043a, \u043f\u043e\u0440\u0430 \u0443\u0447\u0438\u0442\u044c\u0441\u044f \u0433\u043e\u0442\u043e\u0432\u0438\u0442\u044c \u0435\u0433\u043e \u043a production \u0432 \u0447\u0430\u0441\u0442\u0438 \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e\u0441\u0442\u0438. \u0414\u0430\u043d\u043d\u0430\u044f \u0437\u0430\u043c\u0435\u0442\u043a\u0430 \u0432\u043f\u043e\u043b\u043d\u0435 \u043c\u043e\u0436\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0432 \u043b\u044e\u0431\u043e\u043c \u0432\u0435\u0431-\u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0438, \u043d\u043e \u0440\u0430\u0441\u0441\u043a\u0430\u0437\u044b\u0432\u0430\u0442\u044c \u0431\u0443\u0434\u0443 \u043d\u0430 \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u043f\u0440\u043e\u0441\u0442\u043e\u0433\u043e \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u043d\u0430 Revel.  <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-271529","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/271529","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=271529"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/271529\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=271529"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=271529"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=271529"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}