omniauth-identity icon indicating copy to clipboard operation
omniauth-identity copied to clipboard

broken registration_path when SCRIPT_NAME is not empty string

Open btalbot opened this issue 8 months ago • 0 comments

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.

btalbot avatar Jun 15 '24 23:06 btalbot