kitensei
kitensei

Reputation: 2530

Redirecting to relative path using Laravel 4

Is it possible, in Laravel 4.1, to redirect to a relative path instead of the full path ? If we look at the UrlGenerator::to method, here what we have:

 public function to($path, $extra = array(), $secure = null)
    {
        if ($this->isValidUrl($path)) {
            return $path;
        }
        $scheme = $this->getScheme($secure);
        $tail = implode('/', array_map('rawurlencode', (array) $extra));
        $root = $this->getRootUrl($scheme);
        return $this->trimUrl($root, $path, $tail);
    }

This will act like this (meta-code):

mysite.com/url Redirect::to('/test'); => mysite.com/test

What I'd want it's to be redirected to a relative URL:

mysite.com/url Redirect::to('/test'); => /test

The problem it's that the company I'm working for, use a ReverseProxy to redirect all the traffic to HTTPS protocol, and with this kind of laravel redirects I keep getting redirected from HTTP to HTTPS :

And the problem is that the submit form fail.

Is there a possibility to redirect to the relative path and let the proxy define the root url / protocol to use ?

Upvotes: 1

Views: 958

Answers (1)

sulaiman sudirman
sulaiman sudirman

Reputation: 1845

I'm on Laravel 4.2, I'm using Redirect::away('/test'), not sure if the function is there yet on Laravel 4.1.

Upvotes: 1

Related Questions