Resolved using my own way: changed lavender theme's source code.
How to force HTTP to HTTPS?
-
Hi everyone, I have just begin to learn about Nodebb and it is a great forum. I need to run (force) all http connections to https, how could I do that that please? E.g. if I type http://mysite.com in the address bar. then https://mysite.com loads instead. I have a signed SSL already installed on the server, and both http://mysite.com and https://mysite.com work fine. Thanks
-
Hi there @springway
You'll want to add a new
server
block to intercept HTTP traffic and redirect it to your HTTPS site:server { listen 80; server_name mysite.com; return 301 https://mysite.com$request_uri; }
-
@julian Hey, thanks @julian for your reply. Currently I configured the server block (btw I am using Nginx v1.6.2 to proxy the port number in the URL) in a way to handle both HTTP and HTTPS protocols:
server {
listen 80 default_server;
listen [::]:80 default_server ipv6only=on;
listen 443 ssl;... location to ssl certificate and key + SSL specific config;
... server root info;
server_name mysite.com www.mysite.com;
location / {
# proxy, proxy pass and socket.io info to handle the port and use mysite.com instead of mysite.com:4567 (same as Nodebb user manual)
}
}Shall I add a new server block to force reload HTTPS instead of HTTP connections or just add the return 301 command to current server block? Thanks
-
In this site, we have two server blocks. One for http connections, listening on port 80,which redirects to https, and another for the proper https connection
-
Awesome, thanks @julian
I created a second server block to handle all HTTP connections and redirects them to HTTPS server block and it works great.
Thanks -
@julian can this (redirect all HTTP requests to HTTPS) be done with Apache?