Closed johnny77221 closed 8 months ago
@johnny77221 it looks like you're trying to connect to https://localhost/oauth2/access_token
I think it should be http://local.edly.io
like you have in your screenshot but maybe that config wasn't saved? In anycase, it makes sense that you got an error fetching the https
url for localhost since you don't have TLS setup locally.
they are in different docker containers so I have set up the network to have them connected (72.20.128.3 -> 72.20.128.2) I doubt something happened in caddy that only accepts connections in domain name so I also set /etc/hosts in wordpress container to have local.edly.io point to 172.20.128.2 but somehow the http url was redirected to https so the error message above appears I am not familiar with how the caddy works so I have no idea how to move the next step from now
Hello, @johnny77221, thanks for your patience. I could replicate your error. The only thing I didn't do was create a network.
The error occurs because when you click "Generate JWT Token," the request is generated in the docker container you are running your WordPress, and your Open edX platform should be running in your machine and not inside the WordPress container. And for that reason, you couldn't reach out to the local.edly.io inside the docker container.
An easy way to check that you couldn't reach correctly the localhost inside the WordPress container is running something like this:
curl -I http://local.edly.io:8000
You should be able to obtain a response from your machine but not from the WordPress docker container. (Because the local.edly.io:8000 points to localhost:8000, and inside your WP docker container, you don't have it running)
This is not a solution, but I found a workaround that can work for you:
local.edly.io
to your IP (IPv4 Address), e.g., 195.123.xx.x
.That is the super easy one, but I prefer to still use the local.edly.io
, and for that, I did the following steps:
docker exec -it <container_name_or_id> bash
echo "195.123.xx.x local.edly.io" >> /etc/hosts
There are probably better ways to do this, but that should be enough for now.
Note: I don't have the issue of changing HTTPS from HTTP in my tests.
Please let me know if this helps you.
References
Side note: If I'm using eox-tenant, I need to add something like http://195.123.xx.x:8000/ in my redirect uris in my Application.
Thanks Setting the domain in /etc/hosts do the trick
when I have created docker network: docker network create --subnet 172.20.0.0/16 --ip-range 172.20.128.0/20 wpedx docker network connect --ip 172.20.128.2 wpedx 621a38811bf6 #tutor_local-caddy-1 docker network connect --ip 172.20.128.3 wpedx f456aad7345b #wp-wordpress
I should set record 172.20.128.2 local.edly.io
in Wordpress's container
so that wordpress can connect to local.edly.io(access caddy)
and token can be generated
I am trying to use this on docker version of Wordpress 6.3.1, following these steps on the repo: https://github.com/mjstealey/wordpress-nginx-docker except I changed to use image: wordpress:6.3.1-php8.1-fpm after starting tutor local launch, the tutor(openedx) and Wordpress runs successfully and both accessible wordpress is on http://localhost:8443, tutor is http://local.edly.io
I also built network between two containers docker network connect --ip 172.20.128.2 multi-host-network c729d4c7074d #tutor_local-caddy-1 docker network connect --ip 172.20.128.3 multi-host-network f456aad7345b #wp-wordpress
I created OAuth application for wordpress, but when I try to set it in wordpress plugin, it shows up an error
Error: cURL error 7: Failed to connect to localhost port 443 after 0 ms: Couldn't connect to server (see https://curl.haxx.se/libcurl/c/libcurl-errors.html) for https://localhost/oauth2/access_token
do you have idea about how to correctly set this up in this case?