sruupl / batflat

Lightweight, fast and easy CMS for free. Bootstrap ready. https://batflat.org
MIT License
135 stars 54 forks source link

Issues with https #76

Closed vithultnair closed 4 years ago

vithultnair commented 4 years ago

Hi batflat Community,

Cover/featured image url, tags input in admin panel and og meta properties doesn't seems to work properly while using ssl.

Suggestions: An option to add cover/featured image from an external link so that one can add image from cdns like cloudinary! It would be helpful for those who is on a shared hosting with limited resources.

michu2k commented 4 years ago

Hi Please, check if you don't have hard-coded http instead of https in your theme.

vithultnair commented 4 years ago

Not really! I checked everything and found the http links are generated by the following elements {$value.cover_url} - (In blog file) {$post.cover_url} - (In post file) {?= $post.author.avatar ?} - (In post file) All of these are dynamically generated and have nothing to do with the theme!

I've made a temporary fix by using str replace, but i know it's not the right thing to do. <img src="{?= str_replace( 'http://', 'https://', $value.cover_url ) ?}" alt="{$value.title}">

Also the og:image attribute being generated automatically is having an http url, but i couldn't figure out where it is being generated from! :(

michu2k commented 4 years ago

Batflat has https support and should generate the URL correctly. Maybe you can try to force your website to redirect to https. https://stackoverflow.com/questions/4398951/force-ssl-https-using-htaccess-and-mod-rewrite

vithultnair commented 4 years ago

That didn't make a change! Still the urls generated are http:// ! It would be better if there was an option to enter the base url in admin panel which will prevent issues like this!

michu2k commented 4 years ago

Enable DEV_MODE in inc/core/defines.php Open DebugBar and in Requests tab should be[HTTPS] => on. If you can't find this line, then there is probably a problem with your server. Please check if our SSL is correctly installed.

If the problem persists, you can manually set the https protocol: Open inc/core/lib/functions.php; Find $protocol = 'http://'; and replace with https://.

Cheers

vithultnair commented 4 years ago

Got it working finally! I don't have an SSL at my origin server, i am using cloudflare SSL. So the script couldn't determine that my site have an SSL! eventhough this is not a permanent fix ,this will solve my problem for now! Thanks @michu2k

Btw please note that Batflat couldn't determine whether the site is on https or not correctly while the site uses an ssl from cdn like cloudflare.

Also please lemme know if there is any fix for error with Sitemap module(error code: 500) .

michu2k commented 4 years ago

There is no official fix for the sitemap error. You can check possible fixes created by sim2github https://github.com/sruupl/batflat/pull/39

vithultnair commented 4 years ago

Okay 😊 Thanks again @michu2k Loving Batflat

renatofrota commented 4 years ago

Not really! I checked everything and found the http links are generated by the following elements {$value.cover_url} - (In blog file) {$post.cover_url} - (In post file) {?= $post.author.avatar ?} - (In post file) All of these are dynamically generated and have nothing to do with the theme!

I've made a temporary fix by using str replace, but i know it's not the right thing to do. <img src="{?= str_replace( 'http://', 'https://', $value.cover_url ) ?}" alt="{$value.title}">

Also the og:image attribute being generated automatically is having an http url, but i couldn't figure out where it is being generated from! :(

79 fixes the problem. Merged to master already, should be released next update or you can add the line manually: https://github.com/sruupl/batflat/pull/79/commits/b054bd67e954dca6a8a1176084eb369a3dff33c3