Skip to content

broken registration_path when SCRIPT_NAME is not empty string #119

Closed
@btalbot

Description

@btalbot

Rack sets SCRIPT_NAME when a path is mapped to an app. So, a rack app built like below will route
all requests starting with /myapp to MyApp and everything else to OtherApp. For an HTTP request
like /myapp/foo/bar the MyApp will see SCRIPT_NAME='/myapp' and PATH_INFO='/foo/bar'.

Rack::Builder.app do
  map '/myapp' do
    run MyApp
  end
  run OtherApp
end

The Identity#registration_path and Identity#registration_result methods ignore the script_path
and assume it's always empty-string.

If the identity middleware is mapped to /myapp like above then #registration_path will
return as /auth/identity instead of /myapp/auth/identity. This causes any forms to include
a link to the wrong path and any requests for the correct path to fail the #on_registration_path?
check.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions