• As you can see in the image above when I try to add any image I get the red error. And you can see in the rest request it says: “Image file does not exist on remote server or there was an error accessing the file.” – Unfortunately it’s not telling me anything else about the error. I tested this for Unsplash, Pexels, and the others.

    Please advise.

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author Darren Cooney

    (@dcooney)

    Hi @timsayshey Strange – I’m not getting any issues on my end so it’s likely not API related.

    Do you have any other sites you can test on to see if maybe this is a security thing blocking on this specific site?

    Thread Starter eCardWidget.com

    (@timsayshey)

    if ( false !== strpos( $url, $server_ip ) || false !== strpos( $url, $server_name ) ) {
    	return false;
    }

    The error was being caused by the above security check. For some reason my server has SERVER_ADDR and SERVER_NAME set to NULL. Guess it has something to do with Caddy, Docker or Cloudflare. For now I am defaulting them in the config.php to get by which solved the error.

    Plugin Author Darren Cooney

    (@dcooney)

    Interesting. And nice find, I wouldn’t have been able to diagnose this for you.

    This ‘fix’ was put in place last release because of an admin level exploit.

    🤔Need to think about how to account for this. Maybe I could add a constant or something where if it’s in the WP Config it skips this additional security check.

    Thread Starter eCardWidget.com

    (@timsayshey)

    This is what I put in my config file that checks to make sure the two values are set, and they aren’t, it falls back:

    $_SERVER['SERVER_ADDR'] = isset($_SERVER['SERVER_ADDR']) ? $_SERVER['SERVER_ADDR'] : $_SERVER['HTTP_X_FORWARDED_FOR'];
    
    $_SERVER['SERVER_NAME'] = isset($_SERVER['SERVER_NAME']) ? $_SERVER['SERVER_NAME'] : $_SERVER['HTTP_HOST'];
    Plugin Author Darren Cooney

    (@dcooney)

    @timsayshey Thanks for providing this.

Viewing 5 replies - 1 through 5 (of 5 total)

The topic ‘Error when trying to add image’ is closed to new replies.