-
-
Save playwellsteve/8eec0726a94b7a38066e10842130a5e2 to your computer and use it in GitHub Desktop.
Rewriting Links
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace App\Http\Middleware; | |
use Closure; | |
class RewriteLinks | |
{ | |
/** | |
* Handle an incoming request. | |
* | |
* @param \Illuminate\Http\Request $request | |
* @param \Closure $next | |
* @return mixed | |
*/ | |
public function handle($request, Closure $next) | |
{ | |
if (app()->environment('local') && $request->hasHeader('x-original-host')) { | |
url()->forceRootUrl('http://'.$request->header('x-original-host')); | |
} | |
return $next($request); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Middleware for rewriting absolute links on the fly who using "valet share"