[Knacksteem] Loading site via http:// doesn't redirect to https://

View this thread on: d.buzz | hive.blog | peakd.com | ecency.com
·@tobias-g·
0.000 HBD
[Knacksteem] Loading site via http:// doesn't redirect to https://
#### Project Information
* Repository: https://github.com/knacksteem/knacksteem.org
* Project Name:  Knacksteem

#### Expected behavior

When a user attempts to launch Knacksteem via HTTP they should automatically be redirected to https://, based on the following pull request https://github.com/knacksteem/knacksteem.org/pull/16 the site should automatically redirect a user when attempting to load the site via http://

#### Actual Behaviour

If you visit http://knacksteem.org it will not automatically redirect the user, it will instead cause cross-origin errors and the categories will not be loaded. Overall the site was not usable via http://

#### Steps to reproduce

1. Go to http://knacksteem.org

Note: The http:// within the URL

#### Error Details

The following errors are present in the console upon load of http://knacksteem.org

![image.png](https://ipfs.busy.org/ipfs/QmR7PrrDE9K84PByryaDsnpY88ZfGWp1Js41coascwUaYM)

#### Issue resolution

This could potentially be resolved by using:

`express-force-https` in server.js

First define secure as below:

`const secure  =  require('express-force-https')`

and then add 

`app.use(secure)`

I can see that there is already `app.use(redirectToHTTPS([/localhost:(\d{4})/], [], 301));` within server.js and although I'm not familiar with that library, my solution may potentially conflict without me being able to conduct further testing. 

#### Environment

- Browser: Google Chrome (Version 65.0.3325.162 (Official Build) (64-bit))
- Device: MacBook Pro (Retina, 15-inch, Late 2013)
- Operating system: MacOS HighSierra Version 10.13

#### Reporting & Resolution

Since the issue that was made here:

https://github.com/knacksteem/knacksteem.org/issues/60

This issue has been resolved and if you go to http://knacksteem.org you will see that it successfully redirects you to https://knacksteem.org/. This can be seen in the following commit:

https://github.com/knacksteem/knacksteem.org/commit/578eeb6d4290bd17952ff025df0b8abd7adfa35c

#### GitHub Account

A link to my GitHub account can be found here:

https://github.com/tobias-g1
👍 , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , ,