PerlDancer / PerlDancer/Dancer2

Doubled name in URL on redirect

Open
#1,135 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Question
Dominant language
Perl
Stars
604
Forks
288
Avg merge
1d 5h
Merged PRs (30d)
5

Description

I'm using the YARBAC plugin for authentication and seeing some strange behavior. I thought at first it was a YARBAC issue but it may be a bug in Dancer2 instead. I have login required. When a user requests a route, the program checks to see if they're logged in. If not, they're redirected to the login page and, after successful login, they should be redirected to the original route. What I'm seeing is that instead they're redirected to a route which has the project name doubled up. I'm running the program over Apache via fcgi, so the base URL for the site is www.mydomain.org/myproject. If the user requests www.domain.org/myproject/route1, then after login they're redirected to www.mydomain.org/myproject/myproject/route1 instead. myproject is listed in the URL twice.

I added an extra debug statement to the YARBAC _require_login What I've found is this:

'[myproject:30092] debug @2016-02-25 05:07:04> YARBAC ========> base is https://www.mydomain.org/myproject and request is /myproject/passdown in /usr/local/share/perl/5.14.2/Dancer2/Core/Hook.pm l. 33'

So myproject is included as both the last entry in request->uri_basel and the first in request->request_uri.

This leads to it being doubled up in the resulting redirect.

I'm not sure if I have something set wrong somewhere or if this is simply a bug but any help narrowing it down would be greatly appreciated.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with Dancer2/Core/Hook.pm at line 33 and the YARBAC _require_login hook, comparing request->uri_base with request->request_uri when the application runs under Apache via FastCGI. Reproduce the login redirect with a project subpath and determine whether the project name is duplicated in the resulting URL.

Written by the indexing model from the issue text.

Assessment

Tech stack
perl
Domain
backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.