Building a Rack Middleware - Shopify
Sep 4, 2013

Summary
This post details the creation of a custom Rack middleware to sanitize invalid user input for shop URLs before they are passed to OmniAuth. It explains the problem of malformed shop URLs (e.g., including 'http://' or spaces) and how this leads to URI exceptions. The solution involves implementing a middleware that runs before OmniAuth, using a strategy pattern for sanitization. A specific strategy for cleaning whitespace and converting spaces to dashes is demonstrated. The post also outlines the basic structure of a Rack response and how middleware is initialized.