Pages

21 May, 2022

Signed Route In Larave 9

 I have added signed route. and it is working perfectly. but the problem is, when I start the server and hit 127.0.0.1:8000 in the browser it shows 403 INVALID SIGNATURE. when I give a route like this 127.0.0.1:8000/welcome than it is working. please someone help me, so that this 127.0.0.1:8000 works with sign route.

i am using laravel 9

My Route Route::get('/', [App\Http\Controllers\website\HomeController::class, 'index'])->name('/')->middleware('signed');

scerrnshot of error

Video


  • You can't access 127.0.0.1:8000/ (i.e. route /) without providing a valid signature. You specified this requirement yourself when requiring / to be signed. I don't understand what your issue is here. Are you actually providing a valid signature and it's not working?  Apr 9 at 5:01 
  • @apokryfos i am providing a valid signature and working fine. but the issue is happing for the first time when i hit http://127.0.0.1:8000/ in the browser. first time this shows 403. but when i brows other URL than it is working file.  Apr 9 at 5:10
  • @apokryfos i would like to request you to watch this 58 sec video. video link - drive.google.com/file/d/13ETivLzTiT5lLavXDpXs4y3dch5juhLx/view  Apr 9 at 5:17 
  • I still don't understand what you want to do. When your route is signed you must always provide a valid signature. This looks like an XY problem  Apr 9 at 5:43

1 Answer

0

Answer in your question. If do you want to use signed url for root page you must implement this with sign. You don't. If you define your route like this:

Route::get('/', [App\Http\Controllers\website\HomeController::class, 'index'])->name('/')->middleware('signed');

you should use sign for access this page.

For example imagine two routes

Route::get('/a', [HomeController::class,'index'])->name('homepage');
Route::get('/', [HomeController::class,'index'])->name('homepage2')->middleware('signed');

if in your index view you call signed homepage2 you don't get 403

No comments:

Post a Comment

Thanks