Slide 1

Slide 1 text

#BTJDೝূͷՄࢹԽ P[X

Slide 2

Slide 2 text

લఏ ৽نϓϩδΣΫτ࡞੒࣌ #"4*$ೝূͰެ։อޢ ։ൃ࣌ *%18ͷೖྗ͕໘౗ͳͷͰϒϥ΢βʹอଘ

Slide 3

Slide 3 text

લఏ ϦϦʔε௚લ #BTJDೝূΛղআɺͨͩ࢖͍ͬͯΔҙ͕ࣝ ബΕ͍ͯΔͷͰղআΛ๨Εͯ͠·͏͜ͱ ͕͋Δ

Slide 4

Slide 4 text

લఏ ϦϦʔε௚લ #BTJDೝূΛղআɺͨͩ࢖͍ͬͯΔҙ͕ࣝ ബΕ͍ͯΔͷͰղআΛ๨Εͯ͠·͏͜ͱ ͕͋Δ #"4*$ೝূΛ࢖͍ͬͯΔ͜ͱΛ
 ๨Εͳ͍Α͏ʹ͍ͨ͠

Slide 5

Slide 5 text

CBTJD@BVUI@NBSLHFN

Slide 6

Slide 6 text

CBTJD@BVUI@NBSLHFN w#"4*$ೝূ͕ઃఆ͞Ε͍ͯΔͱ(JUIVC SJCCPOΛදࣔͯ͘͠ΕΔ(FN w3BJMTFOWΛSJCCPOͰදࣔͯ͘͠ΕΔSBDL EFWNBSLHFNΛࢀߟʹ࡞੒

Slide 7

Slide 7 text

࢖͍ํ # Gemfile gem 'basic_auth_mark' $ bundle install

Slide 8

Slide 8 text

΍͍ͬͯΔ͜ͱ w3BJMTBQQىಈ࣌ʹ3BDL.JEEMFXBSFʹ CBTJD@BVUI@NBSLΛ௥Ճ wSFRVFTU࣌ʹ#"4*$ೝূͷϔομ͕ೖͬͯ ͍ͨΒSJCCPOΛදࣔ

Slide 9

Slide 9 text

3BDLNJEEMFXBSF class Middleware1 def initialize(app) # app == Middleware2 @app = app end def call(env) # Middleware2ͷcall͕ݺ͹ΕΔ. res = @app.call(env) # ඞཁʹԠͯ͡ॲཧΛߦ͏. res end end

Slide 10

Slide 10 text

ྫɿTFOUSZͰͷ࢖ΘΕํ # sentry-raven
 def call(env) # ... begin response = @app.call(env) rescue Error raise # Don't capture Raven errors rescue Exception => e Raven::Rack.capture_exception(e, env) raise end # ... response end

Slide 11

Slide 11 text

CBTJD@BVUI@NBSLͰͷ࢖͍ํ def call(env) status, headers, response = @app.call(env) if basic_auth? # to # to
new_response = insert_basic_auth_marks(response) # update body size. headers['Content-Length'] = new_response.bytesize.to_s response = [new_response] end [status, headers, response] end

Slide 12

Slide 12 text

#"4*$ೝূͷ൑ఆ SFRVFTUIFBEFS
 "VUIPSJ[BUJPO#BTJD\#BTFFODPEF JEQX ^ ͜ͷϔομ͕ϦΫΤετʹؚ·Ε͍ͯΔ৔߹
 #"4*$ೝূ͋Γͱ൑ఆ

Slide 13

Slide 13 text

໰୊ w αʔόʔଆͰ#"4*$ೝূΛ੾ͬͯ΋ΫϥΠΞϯτ ϒϥ΢ β ͸"VUIPSJ[BUJPOϔομΛૹΓଓ͚Δ w ࣮ࡍʹ#"4*$ೝূΛ͔ͨ͠Ͳ͏͔͸SBDLNJEEMFXBSFʹ ౉Δ৘ใ͔Β͸Θ͔Βͳ͍ ೝূʹ੒ޭͨ͠৔߹ͱೝূ͠ ͳ͔ͬͨ৔߹Ͱม਺͕ಉ͡ w ͳͷͰɺݱঢ়͸"VUIPSJ[BUJPO#BTJDϔομͷ༗ແͷΈͰ ൑ఆ͍ͯ͠Δ αʔόʔͰೝূ੾ͬͨ͋ͱ΋SJCCPO͕දࣔ ͞Εͯ͠·͏

Slide 14

Slide 14 text

ͱΓ͋͑ͣͷ ରԠࡦɹ $ISPNF
 DISPNFSFTUBSU
 DIPSNF͸ϦελʔτͰ#"4*$ೝূͷΩϟογϡ͕ΫϦ Ξ͞ΕΔΑ͏ όʔδϣϯʹΑΔʁ 4BGBSJ
 
 #"4*$ೝূΩϟογϡͷํ๏͕ݟ͚ͭΒΕͣɻɻ

Slide 15

Slide 15 text

͜Ε͔Β΍Γ͍ͨ͜ͱ w ࠶ىಈ΍ΩϟγϡͷΫϦΞΛ͠ͳͯ͘΋#"4*$ೝূΛ൑ ఆͰ͖ΔΑ͏ʹରԠ w ࣾ಺ϓϩμΫτͰͷར༻

Slide 16

Slide 16 text

͋Γ͕ͱ͏͍͟͝·ͨ͠