Brotli and Gzip Compression for Assets and JSON API in Rails Updated May 26, 2020 8 minute read HTTP content compression has a significant impact on the client-side performance of a web app. In this blog post, Iâll describe different methods for compressing dynamic and static content in Ruby on Rails apps using Gzip and Brotli algorithms. Weâll start by describing what exactly is a content compres
åå ã®è¨äºã§ãéçãã¡ã¤ã«ã«ãã£ãã·ã¥ãå¹ãããæ¹æ³ãç´¹ä»ãã¾ããã kjugk.hatenablog.com ãã®è¨äºã§ã¯ã次ã®ããã©ã¼ãã³ã¹æ¹åçã¨ãã¦ã éçãã¡ã¤ã«ã«gzip å§ç¸®ãããã¦è»¢ééãæ¸ããæ¹æ³ãç´¹ä»ãã¦ããã¾ãã ç°å¢ webpack 4.17.1 nginx 1.12.2 ãªãããµã³ãã«ã¯ãã¹ã¦ãæä½ã® ãã¡ã ã®ã¢ããªã§ãç´ 41 KB ã®ãããã¡ã¤æ¸ã¿ JavaScript ãã¡ã¤ã«ãå§ç¸®ããçµæãæ¯è¼ãã¦ãã¾ãã é ä¿¡æã«å§ç¸®ãã nginx ã§ã¯ãç°¡åãªè¨å®ã§ãã¬ã¹ãã³ã¹ã« gzipå§ç¸®ãããããã¨ãã§ãã¾ããä¸è¨ã¯ js, css ã« gzipå§ç¸®ãé©ç¨ããä¾ã§ãã Enable gzip on Nginx. ãã©ã¦ã¶ã§ç¢ºèªããã¨ãã¬ã¹ãã³ã¹ãããã¼ã« content-encoding: gzip ãä»ä¸ããã¦ãããå§ç¸®æ¸ã¿ã®ãã¡ã¤ã«ãé ä¿¡ããã¦ãã¾ãã
2021-02-01HTTP ã³ã³ãã³ãå§ç¸®ã§ããã©ã¼ãã³ã¹æ¹åäºæ¥æ¬é¨ ãããã¯ãéçºå®¤ã®ã¨ã³ã¸ãã¢ã®ä¸çã§ãã ãªã³ã©ã¤ã³è¨ºçã»æè¬æå°ã»ã¯ã©ã¦ã診çæ¯æ´ã·ã¹ãã ãCLINICSãã®éçºã»åºç¤å¨ããæ å½ãã¦ããã¾ãã ä»åã¯ãHTTP ã®ã³ã³ãã³ãå§ç¸®ã«ã¤ãã¦èª¿æ»ã»å¯¾å¿ããæ©ä¼ããã£ãã®ã§ãæ¬ããã°ã«ã¦ç´¹ä»ãããã¨æãã¾ãã HTTP ã³ã³ãã³ãã®å§ç¸®ã¨ã¯HTTP ã³ã³ãã³ãã®å§ç¸®ã¨ã¯ãHTTP ã®éä¿¡ã«ãã㦠Web ãµã¼ãã¼å´ãè¿ããã¼ã¿ãããªãããã®å½¢å¼ã§å§ç¸®ãã¦ã¯ã©ã¤ã¢ã³ãã«è¿ããã¨ã§ããå§ç¸®ãããã¬ã¹ãã³ã¹ãã¯ã©ã¤ã¢ã³ãå´ã¯è§£åãã¦å©ç¨ãã¾ãã HTTP ã³ã³ãã³ãã®å§ç¸®ã«ãã£ã¦å¾ãããã¡ãªããã»ãã¡ãªããã¯ä»¥ä¸ã®éãã§ãã ⤴ ã¡ãªããéä¿¡ã®å¸¯å使ç¨éãæ¸ãããããã«ãã£ã¦éä¿¡ã«ãããæéãåæ¸ãããã¼ã¸è¡¨ç¤ºé度ãåä¸ã§ãã⤵ ãã¡ãªããå§ç¸®ã»è§£åã³ã¹ããããããã ããå§ç¸®
HTTP ã¬ã¤ã ãªã½ã¼ã¹ã¨ URI ã¦ã§ãä¸ã®ãªã½ã¼ã¹ã®èå¥ ãã¼ã¿ URL MIME ã¿ã¤ãå ¥é ãããã MIME ã¿ã¤ã www ä»ã㨠www ãªãã® URL ã®é¸æ HTTP ã¬ã¤ã HTTP ã®åºæ¬ HTTP ã®æ¦è¦ HTTP ã®é²å HTTP ã¡ãã»ã¼ã¸ å ¸åç㪠HTTP ã»ãã·ã§ã³ HTTP/1.x ã®ã³ãã¯ã·ã§ã³ç®¡ç ãããã³ã«ã®ã¢ããã°ã¬ã¼ãã®ä»çµã¿ HTTP ã»ãã¥ãªã㣠Content Security Policy (CSP) HTTP Strict Transport Security (HSTS) X-Content-Type-Options X-Frame-Options X-XSS-Protection ãµã¤ãã®å®å ¨å HTTP Observatory HTTP ã¢ã¯ã»ã¹å¶å¾¡ (CORS) HTTP èªè¨¼ HTTP ãã£ãã·ã¥ HTTP ã®å§ç¸® HTT
æ¦è¦ åèè ã®è¨±è«¾ãå¾ã¦ç¿»è¨³ã»å ¬éãããã¾ãã è±èªè¨äº: The Lifecycle of a Rails Request åæå ¬éæ¥: 2019/05/02 èè : Godfrey Chan ãµã¤ã: Skylight æ¥æ¬èªã¿ã¤ãã«ã¯å 容ã«å³ãããã®ã«ãã¾ãããç»åã¯å è¨äºã®å¼ç¨ã§ãã 2019/10/03: åçå ¬é 2022/08/02: æ´æ° åè 以ä¸ã®ãµã¤ãã§ãRailsã®ãªã¯ã¨ã¹ãã®å ¨ã©ã¤ããµã¤ã¯ã«ããã¸ã¥ã¢ã«è¡¨ç¤ºã§è¿½ããã¨ãã§ãã¾ããæ¬è¨äºã¨åããã¦åç §ãããã¨ã§ç解ãé²ãã¨æãã¾ãã ãµã¤ã: Rails Trace rails-trace.chriszetter.comãã æ¬è¨äºã¯ãç§éãRailsConf 2019ã§è¡ã£ãã¹ãã¼ãã®ã¾ã¨ãã§ããã¹ã©ã¤ãã¯ãã¡ãã§ã覧ããã ãã¾ãã ã¨ãã£ã¿ã§ã³ã³ããã¼ã©ã®ãã¡ã¤ã«ãéããã¢ã¯ã·ã§ã³ã¡ã½ããã«Rubyã³ã¼ããå°ã æ¸
ã©ã³ãã³ã°
ã©ã³ãã³ã°
ã©ã³ãã³ã°
ãªãªã¼ã¹ãé害æ å ±ãªã©ã®ãµã¼ãã¹ã®ãç¥ãã
ææ°ã®äººæ°ã¨ã³ããªã¼ã®é ä¿¡
j次ã®ããã¯ãã¼ã¯
kåã®ããã¯ãã¼ã¯
lãã¨ã§èªã
eã³ã¡ã³ãä¸è¦§ãéã
oãã¼ã¸ãéã
{{#tags}}- {{label}}
{{/tags}}