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

Images not working on SSL with https #21

Open
ghostpool opened this issue Apr 16, 2013 · 19 comments
Open

Images not working on SSL with https #21

ghostpool opened this issue Apr 16, 2013 · 19 comments

Comments

@ghostpool
Copy link

Hi there,

Excellent script.

I've had a number of my customers tell me that their images do not display when they use SSL and switch to https in the URL. I'm surprised to see nobody else appears to have brought this up, is there any fix for this, or is it a script issue at all?

@wpexplorer
Copy link

I'm actually trying to figure this out at the moment as well

@ramzesimus
Copy link

I have the same issue on https. Any ideas on this issue would be much appreciated.

@ghostpool
Copy link
Author

I'm glad to see I'm not the only one with the issue. I believe it is something to do with the wp_upload_dir not supporting https, but I'm not sure yet, hopefully this is something the developers of the script can look into.

@syamilmj
Copy link
Owner

If anyone would like to offer a test install with https, I'd be happy to fix this.

Cheers

@ghostpool
Copy link
Author

I have emailed you WordPress login and FTP details to a https server so you can look into this issue. :)

@highergroundstudio
Copy link

I just had the same problem reported to me on my plugin. I never tested in https and didn't think about doing it for some reason. https://github.com/highergroundstudio/myContest/issues/62#issuecomment-24134138

@highergroundstudio
Copy link

Any updates on this?

@wizard247
Copy link

I have this issue too - pulling my web site page into Facebook (car sales dealership) but the car images are not showing through https.

Any chance of this being solved in a future issue or is there a way around it?

Thanks all!

@wizard247
Copy link

Will send you FTP details if you can fix this as you mentioned. :)

@wpexplorer
Copy link

I'm interested to learn of this issue can be resolved. Thanks!

@mxmzb
Copy link
Collaborator

mxmzb commented Nov 9, 2013

If someone grants me access to some suitable setup regarding this issue + I get paid, let's say 300 bucks, I am going to do that for you. Don't get me wrong at the payment point, I'm not greedy, but I am pretty much busy with other things and also suspect, that some of you might be interested in this feature by commercial aspects, so I think it's fair to ask for a piece of the pie.

@wpexplorer
Copy link

@Maximski - price point makes sense to me, but I currently don't have an active site with the issue. I just remember it being a problem in the past and curious to see what the best fix is.

@mxmzb
Copy link
Collaborator

mxmzb commented Nov 10, 2013

@wpexplorer It's just an offer, not more and not less. I have personally have no need for this feature currently, too, so I'm probably not the one implementing this without appropriate motivation. Just saying :)

@miqronaut
Copy link

Most browsers are permitted by default to display http images on https pages, but to accommodate the exceptions, if you are using wp_get_attachment_url() with this script, try adding a filter so image URLs do not always begin with http. http://codex.wordpress.org/Plugin_API/Filter_Reference/wp_get_attachment_url
$_SERVER['HTTPS'] == 'on' in that code did not work on a couple of my servers, but the tweaks below fixed it. Load-balanced servers may need $_SERVER['HTTP_USESSL'] instead.

add_filter('wp_get_attachment_url', 'honor_ssl_for_attachments');
function honor_ssl_for_attachments($url) {
    $http = site_url(FALSE, 'http');
    $https = site_url(FALSE, 'https');
    $isSecure = false;
    if (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off'
    || $_SERVER['SERVER_PORT'] == 443) {
        $isSecure = true;
    }
    return ( $isSecure ) ? str_replace($http, $https, $url) : $url;
}

@wpexplorer
Copy link

@miqronaut - awesome dude, thanks for the heads up!

@jesush
Copy link

jesush commented Aug 22, 2014

Possible solution, why not simply leave out the http protocol out of the image via a filter, it's safe ( http://www.ietf.org/rfc/rfc3986.txt ), Relative URLs ( http://www.paulirish.com/2010/the-protocol-relative-url/ ).

@bre7
Copy link

bre7 commented Jun 18, 2016

Bump... @jesush solution seems to be the best... PR sent 😉

bre7 added a commit to bre7/Aqua-Resizer that referenced this issue Jun 18, 2016
@SantoshTupsy
Copy link

SantoshTupsy commented Nov 17, 2016

x htaccess

  1. Login to your Cpanel
  2. goto "Public_html"
  3. Show hidden files under "Settings"
  4. Right click and edit ".htaccess"
  5. Add "#" at the start to each and every line of code.
  6. Save

@Madison39
Copy link

Thank you SantoshTupsy! This is THE BEST and most simple solution! I have installed different SSL on domain and subdomain and had this images not showing problem in sub-domain. I have spent HOURS to find a way to fix this issue and nothing helped: I tried Really Simple SSL..nothing; changed link url in General..nothing; tried scripts, plugins to force, checked folders permissions, redirects and so on for loooong hours! After i have followed your .htaccess instructions everything came back fast with a simple refresh of the page! You have no idea how thankful i am to you!

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

No branches or pull requests