Slide 1

Slide 1 text

Extending NGINX
 with
 (m)Ruby

Slide 2

Slide 2 text

Some details about me Github: @tylerdiaz YCombinator founder ✈ Love to travel " Programming since 12 # From Puerto Rico ⚒ Backend generalist 
 at Strikingly

Slide 3

Slide 3 text

Standalone web servers Rack web servers T H I N

Slide 4

Slide 4 text

Standalone web servers Rack web servers T H I N

Slide 5

Slide 5 text

NGINX

Slide 6

Slide 6 text

What can NGINX do?

Slide 7

Slide 7 text

What can NGINX do? • Load Balance – Route a request over multiple running versions of your application.

Slide 8

Slide 8 text

What can NGINX do? • Load Balance – Route a request over multiple running versions of your application. • Cache – Extremely efficient caching layer.

Slide 9

Slide 9 text

What can NGINX do? • Load Balance – Route a request over multiple running versions of your application. • Cache – Extremely efficient caching layer. • Resilience – Mitigate Denial of Service with rate limiting.

Slide 10

Slide 10 text

What can NGINX do? • Load Balance – Route a request over multiple running versions of your application. • Cache – Extremely efficient caching layer. • Resilience – Mitigate Denial of Service with rate limiting. • HTTPS – Attach an SSL cert (https://letsecure.me/)

Slide 11

Slide 11 text

What can NGINX do? • Load Balance – Route a request over multiple running versions of your application. • Cache – Extremely efficient caching layer. • Resilience – Mitigate Denial of Service with rate limiting. • HTTPS – Attach an SSL cert (https://letsecure.me/) • Service Routing – Complete a feature in a different application setup by a different team.

Slide 12

Slide 12 text

What can NGINX do? • Load Balance – Route a request over multiple running versions of your application. • Cache – Extremely efficient caching layer. • Resilience – Mitigate Denial of Service with rate limiting. • SSL – Serve HTTPS by attaching a certificate via NGINX • Service Routing – Complete a feature in a different application setup by a different team. • Logging – Track your 404s. Useful for understanding a new application stack by analyzing the request/responses.

Slide 13

Slide 13 text

What can NGINX do? • Load Balance – Route a request over multiple running versions of your application. • Cache – Extremely efficient caching layer. • Resilience – Mitigate Denial of Service with rate limiting. • SSL – Serve HTTPS by attaching a certificate via NGINX • Service Routing – Complete a feature in a different application setup by a different team. • Logging – Track your 404s. Useful for understanding a new application stack by analyzing the request/responses. • Access Control – Restrict access to a service by IP.

Slide 14

Slide 14 text

It offers a lot of solutions to handle a visitor’s request

Slide 15

Slide 15 text

What can I do by scripting NGINX?

Slide 16

Slide 16 text

No content

Slide 17

Slide 17 text

No content

Slide 18

Slide 18 text

(m)Ruby A lightweight implementation of Ruby.

Slide 19

Slide 19 text

(m)Ruby A lightweight implementation of Ruby.

Slide 20

Slide 20 text

No content

Slide 21

Slide 21 text

Black box API server #1 Black box API server #2 NGINX / mRuby

Slide 22

Slide 22 text

New endpoint: About us

Slide 23

Slide 23 text

Black box API server #1 Black box API server #2 NGINX / mRuby

Slide 24

Slide 24 text

Black box API server #1 Black box API server #2 NGINX / mRuby

Slide 25

Slide 25 text

NGINX code example nginx.conf

Slide 26

Slide 26 text

NGINX code example content.rb

Slide 27

Slide 27 text

XSS via blog comments

Slide 28

Slide 28 text

nginx.conf

Slide 29

Slide 29 text

filter.rb

Slide 30

Slide 30 text

Disaster Averted

Slide 31

Slide 31 text

Extracting request/ response concerns out of your application

Slide 32

Slide 32 text

• Advanced caching layer • Automatically provision and manage SSL certificates • High availability • Inline critical CSS

Slide 33

Slide 33 text

Go forth. 
 Intercept your requests! 
 With (m)Ruby and NGINX

Slide 34

Slide 34 text

No content

Slide 35

Slide 35 text

No content

Slide 36

Slide 36 text

Code available at

Slide 37

Slide 37 text

Q & A

Slide 38

Slide 38 text

Limitations • No access to the existing ruby gem ecosystem. • 1.9.3 syntax (named parameters coming soon!) • Can’t require files, so your code might get repetitive.