• Welcome to the Chevereto user community!

    Here users from all over the world gather around to learn the latest about Chevereto and contribute with ideas to improve the software.

    Please keep in mind:

    • 😌 This community is user driven. Be polite with other users.
    • 👉 Is required to purchase a Chevereto license to participate in this community (doesn't apply to Pre-sales).
    • 💸 Purchase a Pro Subscription to get access to active software support and faster ticket response times.

External Storage

Status
Not open for further replies.

Barry

💖 Chevereto Fan
Chevereto tries to check if the image is there (your server request file http header from the external storage server). If that fails you will get that 404 thing.
 
So there needs to be a webserver on the sftp server? No big deal, but just need to be sure
 
So there needs to be a webserver on the sftp server? No big deal, but just need to be sure

Of course you need a webserver in the external storage server, otherwise the images can't be served via HTTP.

You should debug the output here:

app/routes/route.index.php

PHP:
        // Test remote image
        if($image['file_resource']['type'] == 'url') {
            $url = preg_replace('/^https:/i', 'http:', $image['file_resource']['chain']['image']);
            $headers = G\getUrlHeaders($url, [CURLOPT_REFERER => G\get_current_url()]); // Add referrer for some CDN restrictions
            $error_tpl = "Can't fetch file header from external storage server: %url (%e)";
            if($headers['http_code'] == 500) { // Internal (curl) error
                $error_e = $headers['error'];
            } else if($headers['http_code'] !== 200) {
                $error_e = $headers['http_code'];
            }
            if($error_e) {
                error_log(strtr($error_tpl, ['%url' => $url, '%e' => $error_e]));
                if($headers['http_code'] !== 200) {
                    return $handler->issue404();
                }
            }
        }
 
A minimal NGINX server config works fine for that.

Without SSL:
Code:
server {
  listen 80;
  server_name your.domain.name;
  access_log /path/to/your/access.log;
  error_log /path/to/your/error.log;
  location / {
    expires 90d;
    root /path/to/your/root/;
  }
}

With SSL:
Code:
server {
  listen 80;
  listen 443 ssl http2;
  listen [::]:443 ssl http2;
  ssl_certificate /path/to/your/certificate.cer;
  ssl_certificate_key /path/to/your/certificate.key;
  ssl_session_cache shared:SSL:20m;
  ssl_session_timeout 60m;
  ssl_prefer_server_ciphers on;
  ssl_ciphers ECDH+AESGCM:ECDH+AES256:ECDH+AES128:DH+3DES:!ADH:!AECDH:!MD5;
  ssl_dhparam /path/to/your/dhparam.pem;
  ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
  add_header Strict-Transport-Security "max-age=31536000" always;
  server_name your.domain.name;
  access_log /path/to/your/access.log;
  error_log /path/to/your/error.log;
  location / {
    expires 90d;
    root /path/to/your/root/;
  }
}
 
Of course you need a webserver in the external storage server, otherwise the images can't be served via HTTP.

You should debug the output here:

app/routes/route.index.php

PHP:
        // Test remote image
        if($image['file_resource']['type'] == 'url') {
            $url = preg_replace('/^https:/i', 'http:', $image['file_resource']['chain']['image']);
            $headers = G\getUrlHeaders($url, [CURLOPT_REFERER => G\get_current_url()]); // Add referrer for some CDN restrictions
            $error_tpl = "Can't fetch file header from external storage server: %url (%e)";
            if($headers['http_code'] == 500) { // Internal (curl) error
                $error_e = $headers['error'];
            } else if($headers['http_code'] !== 200) {
                $error_e = $headers['http_code'];
            }
            if($error_e) {
                error_log(strtr($error_tpl, ['%url' => $url, '%e' => $error_e]));
                if($headers['http_code'] !== 200) {
                    return $handler->issue404();
                }
            }
        }


Thanks _ thought maybe the image was "pulled" via SFTP and presented from the parent server....
 
No, it just fetch the image headers. Anyway, I will remove that for the next version.
 
Status
Not open for further replies.
Back
Top