Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author WisdmLabs

    (@wisdmlabs)

    Hi @pdlbibek

    Please check if the self-request is not blocked on your server?

    Also, check if the abc.com server is able to find out/locate the abc.com
    It might happen that on the abc.com the requests are blocked to self-domain using htaccess file.

    To Check this create a test.php file on abc.com server and send the curl request to that domain.

    The code for the same is as follows:

    $url = 'https://abc.com/';
    $useragent = 'Opera/9.80 (J2ME/MIDP; Opera Mini/4.2.14912/870; U; id) Presto/2.4.15';
    $ch = curl_init('');
    curl_setopt($ch, CURLOPT_URL, $url);
    curl_setopt($ch, CURLOPT_USERAGENT, $useragent); // set user agent
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
    echo $output = curl_exec($ch);
    curl_close($ch);
    echo $contents;
    $url="https://abc.com/lms"

    Add the above code in test.php and check it’s output. If it shows abc.com/lms Homepage then please contact us so that we can check the issue at your end.

    Thread Starter pdlbibek

    (@pdlbibek)

    We already solved the issue.

    What we did:

    1. Checked if all the setup/configuration is correct on the Moodle site.
    2. Checked the connection via hard request URL: https://[moodlesitehere]/webservice/rest/server.php?wstoken=[token-here]&wsfunction=core_course_get_courses&moodlewsrestformat=json
    3. Checked the connection from a test page within our site using WordPress function.
    wp_remote_get( $request_url ); //request url above mentioned
    4. Checked if the server was blocking our request. Contacted server support team as well.
    5. Checked if our site is able to find moodle hosted site via the curl request provided above
    6. Checked if we can get the connection successfully via a different server

    Result
    Moodle configuration were all correct, We did received data via the raw request URL but a 404 error via wp_remote_get(), Server support team said there were no recorded blocks on the server, curl test was successfull and We could connect successfully from a different server. There was a messsage from the error log which say client denied by server configuration

    Conclusion
    Our test directed us towards the core server environment and because we could connect via direct url and even from a different server, we thought our Moodle site and our main site (both hosted on the same server but different domain) config was not the problem at all. Turns out there is this web-server configuration issue which was blocking our GET/POST request.

    Allowing GET, POST, PUT and DELETE requests through the .htaccess (web-server configuration) file of moodle.yoursite.com website did the magic here.

    <Limit GET POST PUT DELETE>
    order deny,allow
    allow from all
    </Limit>

    I wonder why we were able to connect via different server but not via this same server where the Moodle site was hosted. I believe the GET/PUT request permission within the server was different than for a request from a different server.

    Hope this will be helpful for plugin development and many other users experiencing similar problems in the future.

    Hi, I have the same problem however our Moodle is hosted by a Moodle partner so the website and Moodle are on different servers.

    Getting error: cURL error 60: SSL certificate problem: self signed certificate

    Our Moodle URL is https://learn.thelearningrooms.com
    The URL is mapped using a cNAME DNS record if that effects it?

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Please check Moodle URL ! Connection issue’ is closed to new replies.