Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Phalcon\Http\Response::redirect() #1182

Closed
tugrul opened this issue Sep 1, 2013 · 7 comments
Closed

[BUG] Phalcon\Http\Response::redirect() #1182

tugrul opened this issue Sep 1, 2013 · 7 comments
Labels
bug A bug report status: medium Medium

Comments

@tugrul
Copy link
Contributor

tugrul commented Sep 1, 2013

Prepends "/" character internally.

following cases relevant to browser's behavior

$response->redirect('foo/bar');
// actual header (Location: /foo/bar) that means relative to actual domain
// expected header (Location: foo/bar) that means relative to actual path

$response->redirect('/foo/bar');
// actual header (Location: //foo/bar) that means scheme related foo domains bar path
// expected header (Location: /foo/bar) that means relative to actual domain

also there is no requirement to indicate external redirects with second parameter

$response->redirect('http://google.com');
// actual header (Location:/http://google.com)
// expected header (Location: http://google.com)

Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.

@tugrul
Copy link
Contributor Author

tugrul commented Sep 1, 2013

I used the function like following to escape from bug.

$response->redirect('foo/bar', true);

@viktoras25
Copy link
Contributor

Response class only calls $this->getDi()->get('url')->get($url). The actual concatenation is happening here:

PHALCON_CONCAT_VVV(base_uri, slash, uri, slash);

I'm note sure though what changing this place may also affect. If it's not affecting much, I may try to fix it later.

@viktoras25
Copy link
Contributor

Can you try

$this->getDi()->get('url')->setBaseUri("");

in the bootstrapping file. Would it fix your issue?

@dreamsxin
Copy link
Contributor

$response->redirect("http://google.com", true);

@ghost
Copy link

ghost commented Feb 2, 2014

@tugrul External redirects (where the URL explicitly specifies the protocol) no longer require $external parameter — in this case Phalcon automatically detects that the redirect is external.

@Green-Cat
Copy link
Contributor

@phalcon @andresgutierrez
This is fixed.

@ngethe
Copy link

ngethe commented Oct 6, 2017

I use this
$this->response->redirect('http://google.com');
from controller

@niden niden added bug A bug report status: medium Medium and removed Bug - Medium labels Dec 23, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug A bug report status: medium Medium
Projects
None yet
Development

No branches or pull requests

7 participants