Upgrade to Pro — share decks privately, control downloads, hide ads and more …

PEPABO EC tech conference ngx_mruby 2020

PEPABO EC tech conference ngx_mruby 2020

Teppei Yano

June 24, 2020
Tweet

More Decks by Teppei Yano

Other Decks in Technology

Transcript

  1. 2 2 ໼໺ ఩ฏ Yano Teppei @yano3 ʢ΍ͷ͞Μʣ ECࣄۀ෦ Χϥʔϛʔγϣοϓάϧʔϓ

    αʔϏεج൫νʔϜ • https://twitter.com/yano3 • https://github.com/yano3 ⛷ ઇࢁ͕޷͖ ❄ ❄ ❄
  2. 5 ngx_mruby ͱ͸ 5 • mruby ͸૊ΈࠐΈ޲͚ͷܰྔͳ Ruby ࣮૷ •

    Ruby εΫϦϓτͰ nginx Λ֦ுՄೳ • ྨࣅͷ΋ͷͱͯ͠ lua-nginx-module (OpenResty)
  3. 15 15 ΞʔΩςΫνϟ • /apps ΛؚΉύε͸ app-proxy ʹϓ ϩΩγ •

    app-proxy ͸͞ΒʹύεʹΑͬͯ ΞοϓετϦʔϜͷ Web ΞϓϦέʔ γϣϯʹϓϩΩγʢ /note ͳΒϩϦ ϙοϓʂϚωʔδυΫϥ΢υͷΤϯ υϙΠϯτ΁※ʣ ※ WordPress Λىಈ͢ΔόοΫΤϯυͱͯ͠ϩϦϙοϓʂ ϚωʔδυΫϥ΢υΛར༻͍ͯ͠·͢ɻ https://note.com/mclolipopjp/n/ncd713843e4f2 ΧϥʔϛʔWPΦϓγϣϯ
  4. 27 27 ngx_mruby Ͱղܾʂ • ϦΫΤετͷॲཧதʹ http Ͱ API ʹϦΫΤε

    τ • ϓϩΩγͷΞοϓετϦʔϜΛಈతʹมߋ ಈతϧʔςΟϯά
  5. 30 30 ՝୊ • ಉ͡υϝΠϯ্ʹγϣοϓͱ WordPress ͕ଘ ࡏ͢ΔͨΊɺγϣοϓͷ cookie Λ

    WordPress ͔Βࢀরɺૢ࡞Ͱ͖ͯ͠·͏ • WordPress ͷ৐ͬऔΓ΍ѱҙͷ͋ΔϓϥάΠ ϯ͕ଘࡏ͢Δͱ໰୊ʹͳΔ cookie ͷϑΟϧλϦϯά
  6. 31 31 ղܾͷΞϓϩʔν • Χϥʔϛʔγϣοϓͷ cookie ʹ͸໊લʹಛఆ ͷϓϨϑΟοΫΛ෇͚Δ • app-proxy

    Ͱ্هʹ֘౰͢Δ໊લͷ cookie ͸ cookie ϔομ set-cookie ϔομͱ΋ʹϑΟ ϧλ͢Δ cookie ͷϑΟϧλϦϯά
  7. 34 34 • ΞϓϦέʔγϣϯαʔό ͷલ໘ʹ഑ஔͨ͠ ngx_mruby Ͱ cookie ໊ͷ ϓϨϑΟοΫεΛண୤

    • Web ΞϓϦέʔγϣϯʹ ͸खΛೖΕΔඞཁͳ͠ cookie ͷϑΟϧλϦϯά
  8. 35 35 • ϓϨϑΟοΫεͷ෇͍ͨ ໊લͷ cookie ͸ app- proxy ͰϑΟϧλ͠

    WordPress ΁౉͞ͳ͍ • WordPress ͔Βҙਤతʹ ϓϨϑΟοΫεΛ͚ͭͨ ໊લͰ set-cookie ϔομ ͕ૹΒΕͯ΋ϒϩοΫ cookie ͷϑΟϧλϦϯά
  9. 36 36 ngx_mruby Ͱղܾʂ • cookie ϔομΛؚΉϦΫΤετɺϨεϙϯε ֤ϔομΛࢀরɺॻ͖ࠐΈͰ͖Δ αϯϓϧίʔυ •

    https://github.com/yano3/kankara/tree/master/ngx_mruby/cookie_add_prefix • https://github.com/yano3/kankara/tree/master/ngx_mruby/cookie_filter_by_prefix cookie ͷϑΟϧλϦϯά
  10. 38 38 ·ͱΊ 2020೥ͷ ngx_mruby on Χϥʔϛʔγϣοϓ • ৽ͨʹ2ͭͷར༻ࣄྫΛ঺հ ◦

    ಈతϧʔςΟϯά ◦ cookie ϑΟϧλϦϯά • ࠓޙ΋దࡐదॴͰ׆༻͍͖ͯ͠·͢ ngx_mruby ศརʂ