• 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.

Cname and external storage problem

Status
Not open for further replies.

hugendubel

Chevereto Member
Hi,

my problem is, if i use a cname (eg: storage.mydomain.com) that points to Amazon S3, pictures are not showing.

Unbenannt-284a47.png


BUT: if you set the URL to: "storage.mydomain.com" - all uploads are working, they where stored to Amazon, but not showing on "mydomain.com". Now, if you change the URL in control panel from "storage.mydomain.com" (cname) to the original direction ("my-bucket.s3-website.eu-central-1.amazonaws.com"), images are shoing!

If type in browser directly: storage.mydomain.com, you get an error from Amazon:

Code: NoSuchBucket
Message: The specified bucket does not exist
BucketName: storage.mydomain.com
RequestId: 677FB7BB86E858C3
HostId: tCW0Ldhm1Tu0xgCDn9TQaqgggpofO/zOtVCBnOpDvv+d6kBMIEn7MQiXSWmTD4/Si0TxcB8stUo=


A tracerroute to "storage.mydomain.com points to: s3-website.eu-central-1.amazonaws.com
but it normally must Point to: my-bucket.s3-website.eu-central-1.amazonaws.com (ist also set in dns cname record).

If needed, will give you thr URL via PN.
 
Last edited:
Ok, i have set up all these things correctly, but now, next problem.

Images are displayed at the index page of my chevereto installation, i also can access (an see!) all uploaded images in my browser via: storage.domain.com BUT, if i'am clicking on of These Images on my page, get the error, site not exist.

My Settings:

Domain: xxxxxx.xxxxx
Sub-Domain: xxxxx.xxxxxxxx.xxx (cname correct set, bucket correct set)
Example-Image: xxxxxx.xxxxxxxxx.xxxx/2015/01/13/xxxxxxxxx.jpg (works fine, is accessible via browser)
Example-Image-Path: xxxxxxx.xxxx/image/1e (page not exists!)

Sourcecode:
Code:
<div class="list-item-image fixed-size">
<a href="http://www.xxxxxxxxx.xxxxx/image/1e" class="image-container">
<img src="http://xxxx.xxxxx.xxx/2015/01/13/xxxxxxxx.jpg" alt="skin-diamondfc55a.jpg" width="1920" height="1080">
</a>
<div class="list-item-privacy"><span class="btn-lock icon-eye-blocked"></span></div>
</div>


Something still goes wrong.
 
Last edited:
When you use external storage Chevereto doesn't touch at all that server besides from put/delete content. So if you want to restrict the directory view, allow/disallow access or anything like that it must be done in the target external server. In the case of Amazon S3 you have to do all the settings there.
 
Just understand that, but why the external stored images are displayed on the index page correctly (!) (embedded with: external.domain.com/path/to/image/photo.jpg), are accessible via browser (!) but why i'm getting an 404 if i click on the image which go to: domain.com/image/XY ?

Maybe you (or anybody else) have a working S3 website example with a subdomain/cname setup?
 
Last edited:
I used CNAME over a CDN which was over Amazon S3. I found that Amazon S3 settings are not friendly at all for me so I placed a CDN over that (MaxCDN). The system uses cURL to check if the image exists or not in the external storage, maybe the problem is that your curl settings are not working properly (most likely due to https issues).
 
I've test lil bit around and found an "issue". In "route.image.php" is this code:

Code:
if($image['file_resource']['type'] == 'url') {
$headers = G\getUrlHeaders(preg_replace('/^https:/i', 'http:', $image['file_resource']['chain']['image']));
if($headers['http_code'] !== 200) {
return $handler->issue404();
}
}

if you do:

Code:
print_r($headers);
exit;

you get the following:

Code:
Array ( [url] => http://xxxxxxx.xxxx.xxx/2015/01/13/xxxxxxxxxxxx.jpg [content_type] => [http_code] => 0 [header_size] => 0

The Problem: http_code is 0

BUT: If you make an:

Code:
print_r($image['file_resource']['chain']['image']);
exit;

you get the CORRECT Image, and that Image Returns http_code 200 (testet in Firefox with addon)


Also tryed

Code:
if($headers['http_code'] !== 200 || $headers['http_code'] !== 0) {

but still not working. Only solution, delete this http code check, but thats a dirty solution.


cUrl can be the problem, right, i think there is a setting to follow redirects, if this is not set, the check fails.
 
Last edited:
Problem is your server. If I do this:
PHP:
G\debug(G\getUrlHeaders('http://xxxxxxxxxxxxx/2015/01/13/skin-diamond-271061.jpg'));
die();

I get this:
Code:
Array
(
    [url] => http://xxxxxxxxxxxxxxxxxxxx/2015/01/13/skin-diamond-271061.jpg
    [content_type] => image/jpeg
    [http_code] => 200
    [header_size] => 338
    [request_size] => 95
    [filetime] => -1
    [ssl_verify_result] => 0
    [redirect_count] => 0
    [total_time] => 0.484
    [namelookup_time] => 0
    [connect_time] => 0.234
    [pretransfer_time] => 0.234
    [size_upload] => 0
    [size_download] => 0
    [speed_download] => 0
    [speed_upload] => 0
    [download_content_length] => 280932
    [upload_content_length] => 0
    [starttransfer_time] => 0.484
    [redirect_time] => 0
    [redirect_url] =>
    [primary_ip] => 54.231.194.3
    [certinfo] => Array
        (
        )

    [primary_port] => 80
    [local_ip] => 192.168.1.106
    [local_port] => 51419
    [raw] => HTTP/1.1 200 OK
x-amz-id-2: Rpts91jU+MItSUEQsHAJgGvVk2bBqNcFxUBzB5fJlc4QsG08xVCu5dXkKOs7HY8grYgHQwtpYOc=
x-amz-request-id: 785DE1A384420E6E
Date: Tue, 13 Jan 2015 20:42:01 GMT
Last-Modified: Tue, 13 Jan 2015 17:58:06 GMT
ETag: "5bbd43b111cee95592e22ac17910198b"
Content-Type: image/jpeg
Content-Length: 280932
Server: AmazonS3


)

And the function is this:
PHP:
    function getUrlHeaders($url) {
        $ch = curl_init();
        curl_setopt($ch, CURLOPT_URL, $url);
        curl_setopt($ch, CURLOPT_HEADER, 1);
        curl_setopt($ch, CURLOPT_NOBODY, 1);
        curl_setopt($ch, CURLOPT_AUTOREFERER, 1);
        curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
        curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
        $raw = curl_exec($ch);
        $return = curl_getinfo($ch);
        $return['raw'] = $raw;
        curl_close($ch);
        return $return;
    }

Basically cURL is not working properly in your website.
 
Last edited:
Seems so :-(

cURL gives me this error:
Couldn't resolve host

It's now on me to resolve, thanks for your time....can be closed


SOLVED:

Problem was: I just entered a cname record on my registrar, not on my server. So cURL could not resolve this hostname. Added cname also on my server dns, and it works!

-.-
 
Last edited:
Seems to be a DNS issue in your server. Hope you can fix it.
 
SOLVED

See upper post (edited)



PS: Can you please remove my domain name from your post, thanks.
 
Last edited:
Status
Not open for further replies.
Back
Top