inserted images using http url not showing

Started by brynn, February 20, 2018, 05:52:56 AM

Previous topic - Next topic

brynn

Hi Friends,
I think I might be having a problem with the image proxy.  Inserted images using http in the url, don't show up.  Images with https url are showing up as expected.

I checked my settings, and the image proxy is enabled.  Since I don't understand the image proxy very well, I'm not sure what else to check.

I recently upgraded to 2.0.15 (with a lot of help from Lex).  (The short version is that a mod which I had previously uninstall, had not been completely uninstalled.  Once I manually uninstalled it, it worked.)  My change to full https was some months ago, but seemed to be successful at the time. 

I'm actually not sure when this problem first started, but we just now discovered it.  I'm positive that the images which are now missing, were showing previously.  I just don't know when they might have disappeared.

Oh!!  It seems like there was one tiny edit to the proxy.php file in the last upgrade.  Let me check....  Ok, it looks like I did not upload a "fixed" file, which means that when I looked up the codes to change them, I thought there was no change to be made. 

Is there any way to find out what the Find and Add Before code (or Replace, or whatever) was, without reverting the upgrade?

Hhm, shouldn't there be a closing tag, maybe something like this

?>

on the end of a PHP file?  There doesn't seem to be any closing tag in proxy.php file.

Could that be the problem?

Aleksi "Lex" Kilpinen

Could you attach the current proxy.php you are using to your next post? :)
Be aware though that the 2.0.15 image proxy does seem to have an issue where the _first_ load of a proxied image fails, but subsequent views work.
Slava
Ukraini!


"Before you allow people access to your forum, especially in an administrative position, you must be aware that that person can seriously damage your forum. Therefore, you should only allow people that you trust, implicitly, to have such access." -Douglas

How you can help SMF

brynn

No, these are images which were inserted between last Oct 2017 and Jan 2018.  I remember seeing them in their topics previously.

proxy.php attached

Aleksi "Lex" Kilpinen

That would appear to be identical with the one shipped on 2.0.15 upgrade packages.
Could you give a link to post with an image not showing now?
Slava
Ukraini!


"Before you allow people access to your forum, especially in an administrative position, you must be aware that that person can seriously damage your forum. Therefore, you should only allow people that you trust, implicitly, to have such access." -Douglas

How you can help SMF

brynn

#4
I started a thread in our Testing board, so I could test.  https://forum.inkscapecommunity.com/index.php?topic=991.0

Of course you can't see the image in that message.  Shall I set you up as a moderator, so you can open the message for editing?  Or can you just use the source code?

Edit
PS - If you need more than one example, this topic should have several images from the same http domain, which no longer are visible.  https://forum.inkscapecommunity.com/index.php?topic=790.0

Aleksi "Lex" Kilpinen

OK, now if you can dig up your server errorlog - do you see a recent HTTP 500 error in there?
It should reference this url, or at least part of it https://forum.inkscapecommunity.com/proxy.php?request=http%3A%2F%2Fwww.haifashion.de%2Fimages%2Fcat.jpg&hash=895dcacc0b9cfc7109f9491b823133d2
Slava
Ukraini!


"Before you allow people access to your forum, especially in an administrative position, you must be aware that that person can seriously damage your forum. Therefore, you should only allow people that you trust, implicitly, to have such access." -Douglas

How you can help SMF

butch2k

I tested http://www.haifashion.de/images/cat.jpg on my forum using my version of the proxy (which is not the standard one) and it loaded fine.

Your forum fails with a 500 error when attempting to load the picture, could you check your server logs and check if there is any details on the issue ?

[Edit]
Lex was quicker  ;)

butch2k

Could you check using this url https://www.planeteroliste.com/tmp/cat.jpg (same cat file) i want to check if the issue is really http related or specific to some kind of images.

brynn

I don't see any error like that in cPanel > Metrics > Errors.  But didn't you tell me a trick to have the error message displayed?  It seems like it was an edit for the index.php file maybe?

butch2k, I don't understand your message about cat file.  But maybe is directed towards SOL?

brynn

butch2k, oh you mean try inserting the image with that url, in my forum?

Aleksi "Lex" Kilpinen

See if there's a file called error_log in your forum root, or your /cache/images folder.
This isn't a PHP error, so the earlier trick wouldn't necessarily help. We need to get the server's viewpoint of this.
Slava
Ukraini!


"Before you allow people access to your forum, especially in an administrative position, you must be aware that that person can seriously damage your forum. Therefore, you should only allow people that you trust, implicitly, to have such access." -Douglas

How you can help SMF

butch2k

Quote from: brynn on February 20, 2018, 03:47:40 PM
I don't see any error like that in cPanel > Metrics > Errors.  But didn't you tell me a trick to have the error message displayed?  It seems like it was an edit for the index.php file maybe?

butch2k, I don't understand your message about cat file.  But maybe is directed towards SOL?
could you try in your forum the link i provided, it's the same file you try to load from http, but i want you to try the link i posted to check if there is some kind of issue as well when attempting to load from https.



butch2k

Damn i forgot that the proxy as used in standard SMF is used only for http hosted files (not the case on my forum)  ::)

[Edit]
Could you check the access rights of the image cache directory ?

brynn

Found error log in forum root.  There's a whole string of errors related to proxy.php, dating back to Feb 1st, which was approx when I did the upgrade.  This is the error:

[01-Feb-2018 22:46:53 UTC] PHP Parse error:  syntax error, unexpected '===' (T_IS_IDENTICAL) in /home/brynn/public_html/forum/proxy.php on line 197

I don't see any 500 errors.

I've also got some errors for Sub-Posts.php  (not sure how far back they go yet):

[20-Feb-2018 11:00:49 America/Denver] PHP Notice:  Undefined index: character_set in /home/brynn/public_html/forum/Sources/Subs-Post.php on line 1302
[20-Feb-2018 11:00:49 America/Denver] PHP Notice:  Undefined index: character_set in /home/brynn/public_html/forum/Sources/Subs-Post.php on line 1259

brynn

(Sub-Posts.php errors going back a couple of years!)

Aleksi "Lex" Kilpinen

I hate the way some hosts configure their logging... I really do.
We are not likely looking for a PHP code error though, because what the proxy address serves is a HTTP ERROR 500.
Slava
Ukraini!


"Before you allow people access to your forum, especially in an administrative position, you must be aware that that person can seriously damage your forum. Therefore, you should only allow people that you trust, implicitly, to have such access." -Douglas

How you can help SMF

brynn

Not Sub-Posts.php, but Subs-Post.php   :-[

Do you mean this is a log from my host, and not from the forum?

brynn


Aleksi "Lex" Kilpinen

Quote from: brynn on February 20, 2018, 04:26:56 PM
Not Sub-Posts.php, but Subs-Post.php   :-[

Do you mean this is a log from my host, and not from the forum?
Yes, that log is setup by your host. And likely there are many similar scattered around in your folders.

Quote from: brynn on February 20, 2018, 04:27:35 PM
What is the proxy address?
I meant the "end result" of the image being proxied: https://forum.inkscapecommunity.com/proxy.php?request=http%3A%2F%2Fwww.haifashion.de%2Fimages%2Fcat.jpg&hash=895dcacc0b9cfc7109f9491b823133d2
Slava
Ukraini!


"Before you allow people access to your forum, especially in an administrative position, you must be aware that that person can seriously damage your forum. Therefore, you should only allow people that you trust, implicitly, to have such access." -Douglas

How you can help SMF

brynn

So where are we?  Do you need to confirm that it's a 500 error?

Aleksi "Lex" Kilpinen

It is a 500 error, we would want to know what causes the error. Usually, this is where we turn to the server logs.
Not knowing where your host hides them, I'd suggest see if there's another file like that error_log in /cache/ or /cache/images?
If you can't find a log telling us more, then I'd suggest asking your host if they can tell you how to see HTTP errorlogs.
Slava
Ukraini!


"Before you allow people access to your forum, especially in an administrative position, you must be aware that that person can seriously damage your forum. Therefore, you should only allow people that you trust, implicitly, to have such access." -Douglas

How you can help SMF

butch2k

it's a 500, but a 500 means "real bad server error" which does not mean much. There should be some serveur logs which could tell us the reason behind the 500 error.

But it could be in /var/log/.... or in /home/<user>/logs or ... somewhere else, as it depends on the server's config.

brynn

Not in forum/cache or forum/cache/images, or in brynn/logs.  Well there are a couple of error logs in brynn/logs, but they are for a specific date almost a year ago.

I was in my server contol panel (the WHM section) the other day, and was looking for some directory starting /var, but for the life of me, can't find anything like that.  I wonder if it could be hidden?

I'm going to have to log off for today, and probably won't be back until Wed (tomorrow) night or Thurs.  So I'll ask my host for the location of the http error log, before I log off.

Hopefully we can catch up tomorrow evening, and I'll have info from my host.

Thanks for your help!

shawnb61

I suspect permissions issue on the file proxy.php.  It has been reported elsewhere that this has caused http500 issues.   I saw it myself on one of my sites.

So...  In cPanel, in File Manager, what are the permissions for proxy.php?

Address the process rather than the outcome.  Then, the outcome becomes more likely.   - Fripp

lurkalot

This in error console if it's of any relevance,

Failed to load resource: the server responded with a status of 500 (Internal Server Error)       proxy.php

Uncaught SyntaxError: Unexpected token &      index.php?topic=991.0:568

<script type="text/javascript">
  var _paq = _paq || [];
  _paq.push([&#39;trackPageView&#39;]);
  _paq.push([&#39;enableLinkTracking&#39;]);
  (function() {
    var u="//inkscapecommunity.com/stats/";
    _paq.push([&#39;setTrackerUrl&#39;, u+&#39;pi.php&#39;]);
    _paq.push([&#39;setSiteId&#39;, 1]);
    var d=document, g=d.createElement(&#39;script&#39;), s=d.getElementsByTagName(&#39;script&#39;)[0];
    g.type=&#39;text/javascript&#39;; g.async=true; g.defer=true; g.src=u+&#39;pi.js&#39;; s.parentNode.insertBefore(g,s);
  })();
</script>



Failed to load resource: the server responded with a status of 404 (Not Found)       noise.png

brynn

shawneb61, permission for proxy.php is 0666.  I'm afraid I don't clearly understand what that means, although I generally understand the concept of permissions.  Not sure why the permission would change on its own, around the same time I did the upgrade.

lurkalot, I don't understand what you're describing is the problem.  What error console?  However, I recognize that code is what I put in the Global Footer, to allow piwik (now named something like Matomo) to track visitors.  What's wrong with it?  As far as I can tell, Piwik is functioning properly.  Although it's definitely in need of an upgrade.

I'm not sure how piwik and the missing image could be connected.  Except that the piwik code is on every page (including any page with the image (hosted on http) on it).

My host, so far, has not understood my question.  They gave me a list of 3 errors, which I already can see in the cPanel error log (and a portion of some other error log).  They aren't 500 errors.  Waiting for them to respond to my clarification.

brynn

Ok, now they showed me this error, which I think is one that we are looking for?:

hiddenIPaddress - - [22/Feb/2018:05:24:40 -0700] "GET /proxy.php?request=http%3A%2F%2Fwww.haifashion.de%2Fimages%2Fcat.jpg&hash=895dcacc0b9cfc7109f9491b823133d2 HTTP/1.1" 500 - "https://forum.inkscapecommunity.com/index.php?topic=991.0" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/64.0.3282.167 Safari/537.36"

They told me where that log is, which it came from.  And I have seen that log.  I just didn't know it was the one we wanted.  Let me open it, and maybe I'll find more.  Fyi, ssl logs.

Illori

that just shows they hit that URL, that is not an actual error.

brynn

Rats!  Is the ssl log the wrong place to look?  Because that sucker is huge!  15 minutes later, still opening.

Illori

you want to look at the error log. i have seen it called error_log in the same folder that your SMF install is in.

brynn

We've looked at that already, but it doesn't give server errors (like 500).  It is only giving php errors.  There are a bunch of errors for proxy.php.  But Lex says my proxy.php file looks correct.

Illori

the php error is a what the server may show as a 500 error.
please post the errors it has for proxy.php, those are what we are looking for. even if the file looks fine the errors may show something in the logic is not correct.

butch2k

Ask them the php error log if they have it set up.
Could you get the php version as well ?

brynn

I posted the error for proxy.php above, Reply #14.  And my original proxy.php file is attached in Reply #2.

Now, my host has edited proxy.php, which is attached.  You'd think they would have asked....but fortunately I had already saved the original.  I have no idea if their change is proper.  Would you all review it, please?  It looks like it does fix the problem.

It looks to me like the change is near the bottom.  Line 197.

brynn

Interestingly, the line they fixed is the same one indicated in the error.

butch2k

Did you manually edit the file at one point ?

Could you try replacing your proxy.php with the code i provided here: https://www.simplemachines.org/community/index.php?topic=558395.msg3958115#msg3958115

It does a better job at correcting various issues with proxy.php

brynn

I don't remember ever editing it. (edit - Or have any evidence that I edited it, since I save everything I change)  At the 2.0.15 upgrade, there was a failed test for proxy.php.  I don't remember specifically what the Find/Replace/Add Before code was.  But I remember that as best as I could understand it, I didn't really need to edit at all.  (I seem to recall that the Add Before code field was blank, but I couldn't swear to it.)

Uploaded your suggested proxy.php code.  Looks like it works just fine!  https://forum.inkscapecommunity.com/index.php?topic=915.0

Edit
I wonder why the original proxy.php file is still working fine in my other forum?  Should I just leave that one alone?  Or upload the same file there?

Aleksi "Lex" Kilpinen

Interestingly, your host has made the edit leaving their modification visible - and the line they commented out was not in the original file you showed me, and which I compared to the upgrade package version. Unless somewhere along this process you or I mixed up files.

What your original attached proxy.php had to my knowledge:



return file_put_contents($dest, json_encode(array(
'content_type' => $headers['content-type'],
'size' => $response['size'],
'time' => time(),
'body' => base64_encode($response['body']),
))) === false ? 1 : null;;
}
}


What the 2.0.15 upgrade has



return file_put_contents($dest, json_encode(array(
'content_type' => $headers['content-type'],
'size' => $response['size'],
'time' => time(),
'body' => base64_encode($response['body']),
))) === false ? 1 : null;;
}
}


What your host edited file has



return file_put_contents($dest, json_encode(array(
'content_type' => $headers['content-type'],
'size' => $response['size'],
'time' => time(),
'body' => base64_encode($response['body']),
))) === false ? 1 : null;;
/* ))) === false ? 1 : null; === false ? 1 : null;; */
}
}


This would suggest there was indeed an error in the file, and what they did was change it back to what the original file should contain, leaving the erroneous line visible as a comment.
Slava
Ukraini!


"Before you allow people access to your forum, especially in an administrative position, you must be aware that that person can seriously damage your forum. Therefore, you should only allow people that you trust, implicitly, to have such access." -Douglas

How you can help SMF

brynn

I'm not clear what you mean.  Unless it's an extra space somewhere, the code you gave for what I originally attached, and what the 2.0.15 upgrade has, look identical to me.  Also I should say that I don't understand PHP, in case it wasn't already clear.

I don't actually know which file they edited.  I would assume they took the one from public_html/forum/proxy.php.  That's what I attached.  Would there be another proxy.php file somewhere?

I noticed the extra line that they added, between /* and */.  But I don't know what it means.  Are you saying it means that's what they removed?  How could that be, when that was not in the original file? 

And if that line just means that's what they removed, then they didn't really change anything, relative to the original file, right?  The only difference between their file and the original (except for the extra new line), is that they indented the line right before the /* and */ a couple of times.  But could that really be all that was needed to fix it?

I wonder if they could have downloaded something from the download site??  Like an older version or something?

For the record, I did not ask them to look at that file.  I was still trying to get them to tell me where server errors such as 500 error can be found.  And then the next reply was that they edited the proxy.php file.  I was really rather surprised they did that.  For one thing, in the past they've refused to help with forum software, telling me to contact "my programmer" instead.  And second that I didn't ask them to look at it.  And third, they didn't ask me first, before they replaced the original.

In any case, I did not keep that file.  And instead, I uploaded the code that butch2k suggested.  I thought it was more likely to be the best compatible, since my host isn't necessarily as familiar with SMF as you all are here.  Both work though.

I'm still curious why I don't have this problem in my other forum, which is still using the original proxy.php.  Should I just leave it alone?  Or replace with butch2k's file too?

Edit
Aaahh....well I don't have the problem on the other site, about http images not showing.  But I do get the warning about unencrypted contents.  Ooohh....actually I do have this problem there!  It looks like I forgot to enable the image proxy in the first place.  And once I enabled it - goodbye http images!  (It's a nearly dead forum, so not many visitors - probably will switch it to read-only pretty soon.)

But anyway, now fixed with butch2k's file   ;D

Aleksi "Lex" Kilpinen

I am as confused as you are, the original you attached and the 2.0.15 default are identical.
The comment line does look like they removed a line, and replaced it with another line identical with the default, but what they removed was different.

Also, I do feel it odd they edited your files without asking.

I think what you have now is fine, and if the other forum works ok, then that is fine too because it probably has the original code right. If you want to replace it, is up to you really.
Slava
Ukraini!


"Before you allow people access to your forum, especially in an administrative position, you must be aware that that person can seriously damage your forum. Therefore, you should only allow people that you trust, implicitly, to have such access." -Douglas

How you can help SMF

brynn

#41
Well, setting aside the mystery as to what they did....  Well, to me, their edited file still looks identical to the file I started with, so I don't understand why it works.   But since I'm not using their file anyway....

Ooohhh......  I just thought of something....

When you do an upgrade, and there are failed tests with instructions for fixing the file (Find/Replace/Add Before codes) are you supposed to download that file before or after you put the upgrade through (even though it's showing the failed tests)?

I was thinking it wouldn't matter, that I'd get the same file, either way.  I was thinking that putting the upgrade through would not affect the file, because it can't find the right code, so it can't edit the file.  So what does it matter if I download the file before or after I put the upgrade through?  But if the upgrade can edit the file, even though it also gives  the failed tests, then it really might matter whether I download the file before or after putting the upgrade through.

In this case, I had downloaded the file before I sent the upgrade through.  That's the file I shared with you.  But if putting the upgrade through could have changed that file, then that might explain how what they saw was different.


Aleksi "Lex" Kilpinen

If you grab a copy of the file first, and only then install or uninstall a mod, you would need to make sure you get all the edits done manually and upload the manually updated file after the install/uninstall. If you first make the edits, upload the file, and then install or uninstall a mod there's a small chance it will still make further edits and something goes wrong.
Slava
Ukraini!


"Before you allow people access to your forum, especially in an administrative position, you must be aware that that person can seriously damage your forum. Therefore, you should only allow people that you trust, implicitly, to have such access." -Douglas

How you can help SMF

brynn

QuoteIf you grab a copy of the file first, and only then install or uninstall a mod, you would need to make sure you get all the edits done manually and upload the manually updated file after the install/uninstall.

That's what I did.  So that still  leaves a mystery where they got the file that they edited.

In any case, all is fixed now.  I'll mark it  ;)

Pipke

when you site uses ssl and have images or avatars with http instead of https and your site using the proxy.php and then shows no image this can help, atleast it helped me.(set proxy.php to chmod 644)

Quote
500 Error: File is writeable by group



On occasion you may get a 500 page error (a green/blue error page) when trying to run a PHP script in your account. When checking the error og which you can do via the cPanel account log in you may see the following line:

[Wed Jan 31 16:34:12 2011] [error] [client 11.111.111.111] SoftException in Application.cpp:256: File "/home/username/public_html/index.php" is writeable by group

This is due to the server running SuPHP and the files having higher permissions than allowed, to fix this problem you need to make sure your files are chmod 644 for all PHP based files and 755 for directories in order for them to work with SuPHP.You can easily do this by connecting via FTP with Filezilla and right clicking on the problem folders and files and selecting file permissions.
"If something is wrong, fix it if you can. But train yourself not to worry: Worry never fixes anything."

Click here to view my mods for SMF

Hey 👋 Did i helped... you like what i do. You can now buy me a coffee! ☕

Advertisement: