envato/jwt_signed_request

Rack middleware: `REQUEST_PATH` key does not exist

ben-axnick opened this issue · 1 comments

env['REQUEST_PATH'].match(exclude_paths)

In my Rails 5 + puma app, it appears as though this is provided as REQUEST_URI instead. It also looks as though PATH_INFO is another potential variation on the key. I'd like to propose that:

  1. We try to use any of REQUEST_URI, REQUEST_PATH, PATH_INFO, treating them interchangeably
  2. If, for some reason, none of those exist, raise an error

EDIT:

Actually, all that's needed is a s/REQUEST_PATH/PATH_INFO/g

After a bit of reading, the spec says that PATH_INFO should always be present, REQUEST_PATH and REQUEST_URI are non-standard and the former value is somewhat legacy and being phased out. That means we should just check PATH_INFO unless there is a need to maintain compat with some non-compliant rack application.

See: http://www.rubydoc.info/github/rack/rack/file/SPEC