LTI 1.3 and Ngrok

LTI 1.3 and Ngrok

by Ken Yu -
Number of replies: 4

Hi, 

I would like to ask for help.

I am following this ticket: https://tracker.moodle.org/browse/MDL-66920

And would like to try the steps. However, I can't make the ngrok to work. I get an error: redirected too many times.

Can you please give me the correct setting in config.php? 

(It is in this step: As LTI 1.3 launches require to access to the platform public key set, the moodle instance must be reachable from the internet. Consider using ngrok (https://ngrok.com). and update config.php)


Here is my current config.php

?php  // Moodle configuration file


unset($CFG);

global $CFG;

$CFG = new stdClass();


$CFG->dbtype    = 'mariadb';

$CFG->dblibrary = 'native';

$CFG->dbhost    = 'localhost';

$CFG->dbname    = 'moodle';

$CFG->dbuser    = 'root';

$CFG->dbpass    = '';

$CFG->prefix    = 'mdl_';

$CFG->dboptions = array (

  'dbpersist' => 0,

  'dbport' => '',

  'dbsocket' => '',

  'dbcollation' => 'utf8mb4_unicode_ci',

);


$CFG->wwwroot   = 'https://46bd-52-142-205-163.eu.ngrok.io';

$CFG->dataroot  = 'C:\\Users\\Moodle\\Downloads\\Moodleextracted\\server\\moodledata';

$CFG->admin     = 'admin';

$CFG->directorypermissions = 0777;


require_once(__DIR__ . '/lib/setup.php');


// There is no php closing tag in this file,

// it is intentional because it prevents trailing whitespace problems!


Thank you.

Average of ratings: -
In reply to Ken Yu

Re: LTI 1.3 and Ngrok

by Jake Dallimore -
Picture of Core developers Picture of Moodle HQ Picture of Peer reviewers Picture of Plugin developers Picture of Testers
That's an easy one, Ken. Just set:
$CFG->sslproxy = true;
when using ngrok https and it'll work fine. Also recommend registering for ngrok (free) so you can benefit from the increased traffic allowance it provides.

Cheers,
In reply to Jake Dallimore

Re: LTI 1.3 and Ngrok

by Ken Yu -
Thanks Jake but it doesn't work on my end. After I browse thru ngrok url, it will redirect to http://localhost.
I forgot to mention, I installed the windows package (using XAMPP/MySql). I think it only works on provisioning your own apache, moodle and mysql.
In reply to Ken Yu

Re: LTI 1.3 and Ngrok

by Jake Dallimore -
Picture of Core developers Picture of Moodle HQ Picture of Peer reviewers Picture of Plugin developers Picture of Testers
Hi Ken,

There are two lines you need to set in config.php to use ngrok. I had assumed you already had the first but it sounds like you don't.

Add these two below the existing $CFG->wwwroot line (or comment that one out).

$CFG->wwwroot = 'https://XXXXX.ngrok.io/imaster'; // Use your ngrok URL here of course.
$CFG->sslproxy = true;

And that's it. That should work just fine.

Cheers,
Jake
In reply to Jake Dallimore

Re: LTI 1.3 and Ngrok

by Ken Yu -
Amazing! It works now!

Thanks a lot Jake!