Support » Plugin: Edwiser Bridge - WordPress Moodle LMS Integration » Moodle to WP connection not working on AWS EC2

  • Resolved bob95825

    (@bob95825)


    Thanks for the plugin. I’m planning to purchase the full package but wanted to check the basic functionality before buying.
    My moodle and wp sites are both on AWS EC2, running on Apache.
    So I installed the plugin on Moodle (https://moodle.abc.com).
    And I installed the plugin on WP (https://abc.com)
    Both sites are on the same server, same ip, but defined as different sites in Apache.

    I created the web service on Moodle and and added the access token on WP. I was able to sync the courses from moodle to WP without any issues. But when I went back to moodle to add the wp site, I got the dreaded “Please check the URL or wordpress site permalink” error when I clicked on the Test connection. So seems like moodle can’t get through the WP site. I tested with the recommended options here in this forum, including the test.php that you have mentioned before to load the site. Both sites can see each other, I tested the test.php (fetch index page of the other site via curl ).

    So after a lot of debugging, I created a wp site on a different shared host, with a different url http://xyz.com/. I installed the plugin on this one and tried to connect from moodle and was successful. So I thought it just needs to be a different server to work.

    I then created a new EC2 instance in a different account with a different ip, and installed wp on that and pointed my main site to that server (https://abc.com/)

    I still cannot connect from the moodle site to the wp site on aws, even though they’re on different servers and different IPs.

    The only difference between when it worked for me and when it didn’t is that I was using a different url in the shared hosting. And I’m not sure of the ports that are required, but on AWS, I have 80 and 443 open for http and htttps.

    So, what am I missing on AWS that it doesn’t work? The next thing I’m going to try is to point my main domain to the shared host and try connecting again to see if that will work.

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

    (@wisdmlabs)

    Hello @bob95825

    Greetings!

    Thank you for writing to us, we appreciate all the test that you have already performed.

    However, ​please check a few troubleshooting steps that we recommend for resolving this issue.

    a)Please check in the Moodle Edwiser Bridge settings if the WordPress URL is exactly the same as your WordPress Site URL.

    b)Visit your WordPress site. In the WordPress site go to ‘settings –> Permalink’. In Permalinks, please check if the selected permalink is ‘Post name’

    c)Check if you have any security plugins in WordPress which are blocking the API requests. If yes, then test the connection by disabling those plugins or by white-listing your Moodle IP in the WordPress security plugin.

    d)If you have any middleware used for caching like Cloudflare then please allow requests from the Moodle IP or add page rule for this URL: siteurl/wp-json/edwiser-bridge

    e)If you have any Test Moodle site then check ‘Test connection’ with a WordPress site. If it works then your WordPress site is blocking some requests, please Whitelist IP in the server.

    f)If you are using the Wordfence Security plugin then Whitelist Moodle IP address in the plugin setting.

    g)While you copy-paste the token, please check if extra space is added to it or not. If there is an extra space to the start or end then remove it.

    I hope the above is useful to you. You may also drop us an email at edwiser@wisdmlabs.com

    Thanks,
    Dharmesh Barot
    Team Edwiser

    Thread Starter bob95825

    (@bob95825)

    Thanks for the reply Dharmesh. I did a lot more troubleshooting. I re-pointed my https://abc.com to the shared host where it worked with the other domain, but it still didn’t work. Then I looked at the code and tried sending API requests in Postman to https://wp-site/wp-json/edwiser-bridge/wisdmlabs/. Figured out there was an extra space in the token (I did this after re-pointing). Removing the extra space worked on the shared host. So re-pointed the domain to AWS and tried again and immediately, on postman, saw that wp-json wasn’t working (404 error).

    Finally figured out it was a setting in the Apache server blocking access to the .htaccess file in the wordpress directory, thus rewrite engine not routing anything, which led to the error. My only suggestion here for improvement is instead of the generic error message, maybe you should include the actual response from the server so it’ll be easier to debug. If I had seen the “404 not found” as a response from the EC2 server, I would have worked only to look for the fix on AWS instead of trying a variety of things. It would have saved me a lot of time.

    Maybe you should also add the “check if wp api is working” in your troubleshooting list by sending a get request to http://abc.com/wp-json/ 🙂

    In apache2.conf, I had this:
    <Directory /path-to-wp-directory/>
    Options Indexes FollowSymLinks
    AllowOverride None
    Require all granted
    </Directory>

    I changed it to this below and it worked.

    <Directory /path-to-wp-directory/>
    Options Indexes FollowSymLinks
    AllowOverride All
    Require all granted
    </Directory>

    I’m going to be purchasing a 1 year license to begin. If we like it, we might purchase the lifetime too.

    Plugin Author WisdmLabs

    (@wisdmlabs)

    Hello @bob95825

    Greetings!

    We are always looking for ways to better our services, and your feedback is an invaluable part of that process. We’ll ensure that we add this troubleshooting step into our documentation, which will help other users who may encounter a similar problem.

    ​We thank you in advance for choosing our solution 🙂

    Thanks,
    Dharmesh Barot
    Team Edwiser

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Moodle to WP connection not working on AWS EC2’ is closed to new replies.