Laravel 5.4 with SSL - security

I developed a site with Laravel 5.4.
I just installed an SSL certificate and added this to my htaccess:
RewriteCond %{HTTP:Authorization} .
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
I also added this in my AppServiceProvider:
URL::forceScheme('https');
When I go to mysite.co.za it changes to https but when I go to my admin section: mysite.co.za/admin it does not and it shows me an 'i' icon instead of a lock icon on the address bar.
Clicking on the 'i' icon says the site is not secured.
My host reply: This is most likely a configuration issue where the site is using mixed content.
I have no idea what they mean and how to fix it.
Can anyone help please?

I found the solution on this post:
Laravel 5 - redirect to HTTPS
using na-98 answer.
Thank you

Related

htaccess works with www.example.com but not example.com

I have installed Ghost, which needs nodejs to run. I'm doing this on an Apache Linux server via managed hosting. They kindly let me login with SSH access so I've been able to setup nodejs and Ghost using the standard installation instructions. I installed ghost to the root of my domain so in normal operation someone would go to example.com and it'll show them my blog. Well that's what I'd hoped.
However now when I've come to load Ghost in my browser I discover because I'm accessing it the way I am, and that Ghost doesn't do server configuration, I seem to need an htaccess file to be able to make the site reachable.
So, I have created this htaccess file:
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteRule ^$ http://127.0.0.1:65515/ [P,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ http://127.0.0.1:65515/$1 [P,L]
</IfModule>
With that saved to the root, if I go to example.com/ghost (the admin panel for Ghost) it works. Nothing wrong there, looks great. If however I try and visit the root, ie goto example.com, instead of showing me the index, it shows me index.js - that is, it literally loads the contents of Ghost's index.js file and displays it instead of parsing it and displaying the main index of the website.
IF however I go to www.example.com then it all works. So whatever the problem is it's because I'm not using www. in the domain.
I would prefer it to work both with or without the www in the URL though. I did try adding some solutions to redirect non-www requests to www.example.com to th ehtaccess but for some reason it still doesn't work (as in if I type example.com it doesn't redirect me to www.example.com).
I think maybe you should be using mod_proxy rather than mod_rewrite. At least, that's what I've used in the past. Apache will catch requests coming in on port 80 and then redirect them to port 65515 where your node server is listening.
http://httpd.apache.org/docs/2.2/mod/mod_proxy.html#proxypass
Like this:
ProxyPass / http://localhost:65515/
I figured it out. Wasn't anything to do with htaccess, or Ghost or nodejs or anything like it. No, instead the problem was the sodding server was caching the website. I discovered the setting to delete the cache and it all started working fine, so, this is now solved.

Opencart 2.1.0.2 ssl cannot be enabled

I am experiencing a weird problem on enabling ssl on various opencart installations of 2.1.0.2 version.
I have a VPS that has SSL via the new cpanel to all acounts available.
I have already enabled ssl and https on many opencart 1.5 versions, wordpress and even old joomla accounts.
However when i try to enable https on any opencart 2.1.0.2 version via the following procedure i get a bizarre redirection to a suspended account of my vps.
The procedure i follow for ssl in opencart 2.1.0.2 is:
I edit the config.php files both at public_html and admin to
// HTTPS
define('HTTPS_SERVER', 'https://example.com/admin/');
define('HTTPS_CATALOG', 'https://example.com/');
I enable ssl via the backend server settings in opencart
and i add in my .htacces file
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R,L]
right after
RewriteEngine On
I even tried to force https to all links in config files as:
// HTTP
define('HTTP_SERVER', 'https://example.com/admin/');
define('HTTP_CATALOG', 'https://example.com/');
// HTTPS
define('HTTPS_SERVER', 'https://example.com/admin/');
define('HTTPS_CATALOG', 'https://example.com/');
with no luck.
Any ideas?
thank you
Before you add any configuration changes, visit your site:
https://example.com/
If you still get the weird, unexpected page - contact your host, as there's no change in OpenCart you can do to fix a server misconfiguration.
With that said, how did you "enable" SSL? Via Let's Encrypt or a purchased SSL? If you only added the https to your config files, you do not have any SSL enabled. Your host may 'offer' it, but it may not exist by default.
If your host offers it via your cPanel, install a free SSL via the Let's Encrypt cPanel plugin. It should be done automatically and only take a few seconds to complete and you would receive a success message once it's been installed and activated to your site.

Let's Encrypt SSL Causing Issue with Chrome

I have multiple sites on my host using Let's Encrypt and all of them have had no issues. Today I'm trying to install a certificate on joescottocpa.com. The certificate will install but when I visit the site it gives me a Your connection is not private error. When I inspect the certificate it says that it is valid.
I'm able to go to the actual HTTPS address with no issues. When I type just the domain joescottocpa.comin it will sometimes work without issues, sometimes give me the error, and other times just redirect me to my hosting providers homepage.
I am using an .htaccess file to redirect the page, the code on the file is the exact same that I've used for every other site that uses HTTPS. Any help at all would be great.
Thanks!
.htaccess:
RewriteEngine On
RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$ https://joescottocpa.com/$1 [R,L]
The issue was with my host. Something with their settings was off that they wouldn't tell me. Needless to say this host caused issues before so I decided to switch to a new host and the issue was no longer there.

Website Has SSL Issue, Shows in IE and Safari but Not Chrome or irefox

I have a website a company I freelance for took over and since it was transferred their site went down. The website is www.baseline-enserv.com.
For me, it shows up fine in Internet Explorer and safari but in Chrome and Firefox it's redirecting it to an https:// of which it is not.
I have checked the htaccess and it had a https redirect in there which i've removed. I did a database search and didn't find any URL's with https and I checked the wordpress settings for the site itself and it's set to http://.
I can't figure out where else to look to find out what's causing it to redirect. I even checked to see if there was a DNS setting that somehow did it but there is none.
It should NOT be redirecting to https but should be http only.
I also ran a test on geopeeker.com and to my surprise it checks out in all locations, but it may be using the same browser that i'm using that shows up fine.
I also have an account for browserstack so I have tested it on there and it checked out and loaded fine in Firefox 47 and 45, Windows 8 as well as Chrome 50 and 51.
It seems as if it's a caching issue but when I clear my cache and cookies it still doesn't work.
Thanks!
This is all that resides in the htaccess by the way.
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /site/
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /site/index.php [L]
</IfModule>
# END WordPress
They had the site installed into a site folder in the root.
It is definitely a cache mechanise problem. Your site used to have a Permeant Redirect (301) rule in .htaccess. And that is being cached by the browser.
In Chrome, I don't think that "Clear browsing data" will be helpful in this case. There are some workarounds, I think that might help:
For Chrome:
Try to use incognito mode for testing
Try to open the inspector, and go to Settings (three dots on the right side) => check Disable cache (while DevTools is open), and reload the page.
For Firefox:
Private tab will work fine
Or you manually check cache file to make sure by accessing "about:cache"
If none of above work, try to put some random query string after the url for testing. For example:
www.baseline-enserv.com/?test
If it doesn't work too, I think you have to try it out on other machine/device. But after all, that cache will not last for long. And it will soon be cleaned. So, if it is no urgent, just sit back and get some coffee. And get back to it later.
Hope that helps!

Can't access to web site after enabling mod_rewrite

I activated mod_rewrite on my dedicated server : Centos 5.5, after that if I placed any .htaccess in any web site, i can't access the web site from http://site.com/, I have to specify index file, http://site.com/index.php
for example :
I have this web site http://www.floupie.com, the home file is located in http://www.floupie.com/cgi-bin/index.cgi
and I created an .htaccess rule to access it automaticly, but not working :
RewriteEngine on
RewriteRule ^$ /cgi-bin/index.cgi [L]
I have this problem with all web site in the server.
Help Please
Thanks in advance,
Restart the apache server. So that your mod_rewrite work

Resources