Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HTTP POST request to rest endpoint returning Host is unreachable #1403

Open
eherman-godaddy opened this issue May 15, 2024 · 3 comments
Open

Comments

@eherman-godaddy
Copy link

I am trying to send a POST request to a rest endpoint I have running in a playground instance. However, the request is returning PHP Request Startup: Unable to connect to ssl://playground.wordpress.net:443 (Host is unreachable). I have networking enabled in the features.

I'm essentially just running this via runPHP with the JS API:

<?php 
require_once 'wordpress/wp-load.php';
$post = wp_remote_post( get_rest_url( null, '/custom-endpoint/v1/test' ) );

The rest URL does contain the scope

https://playground.wordpress.net/scope:0.2650545321128708/wp-json/custom-endpoint/v1/test

Returns:

PHP Request Startup: Unable to connect to ssl://playground.wordpress.net:443 (Host is unreachable)

Is this not possible or is there another way that I've missed?

@brandonpayton
Copy link
Member

Hi @eherman-godaddy,

This reminds me of #1203 and #1365 which have to do with when Playground handles a request with PHP.

In addition, we just updated DNS to point playground.wordpress.net to a better hosting setup this morning. Perhaps there's something there causing an issue? The old DNS entries had something like a 4 hour TTL. I wonder if clearing DNS cache might have any affect on whether Playground is able to give you a 404 for that path.

Either way, based on my understanding the above issues, I wouldn't guess the custom endpoint request would work today, though I could be wrong.

@eherman-godaddy
Copy link
Author

eherman-godaddy commented May 15, 2024

@brandonpayton Thanks for the quick reply. I'll see if I can find a work around for now, for my needs. Just one more question - when I install the Health Check plugin it says that the cURL module has been disabled. I don't think that was the case previously. Was that recently disabled?
image

Edit:
I think I found my answer here: #1093

@brandonpayton
Copy link
Member

Regarding the original issue, I believe it should be naturally resolved as part of #1203.

As an experiment, you might try adding a ".php" suffix to your custom endpoint name to see whether you are able to access that.

I think I found my answer here: #1093

^ Yep. Unfortunately, Playground on the web does not yet support curl.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants