Redirect HTTP to HTTPS

How do I redirect HTTP traffic to HTTPS for passbolt?

I have the “fullBaseUrl” setup in /etc/passbolt/passbolt.php to https://myserver.fqdn.com but when anyone goes to http://myserver.fqdn.com internally they get the “Welcome to nginx” screen. How do I configure it to redirect HTTP traffic the HTTPS site?

I am using Passbolt CE on Ubuntu 22.04

Thanks,

Find the nginx conf file for your passbolt installation. For example, on my system this is /etc/nginx/sites-available/passbolt.conf. You need a server section for SSL and another one for non-SSL. The latter needs a ‘return 301’ directive. Mine looks like this:

server {
    # Redirect HTTP traffic to HTTPS
    listen 80;
    server_name passbolt.example.com;
    return 301 https://$host$request_uri;
}

There is no passbolt.conf file in that location.

There is a default with no extention, and a nginx-passbolt.conf file.

Thanks,

I think nginx-passbolt.conf might be the default file that was set up by the passbolt installer. I probably changed mine. Make a backup before you change anything in there.

Here is what my conf file looks like. I don’t see a # Redirect HTTP traffic to HTTPS in the sites-available nginx-passbolt.conf file.

sites-available

The conf file you pasted doesn’t contain any of the required SSL information. You could insert that information manually, but I’m more concerned about why your initial installation setup didn’t do that for you. You may want to start your installation over.

In my /etc/nginx/sites-enabled/nginx-passbolt.conf files shows the conf, are you sure yours is sites-available?

Thanks,

And I just tried adding this line return 301 https://$host$request_uri; to the file saved it and restarted nginx and HTTP to HTTPS redirection doesn’t work. :frowning:

Usually sites-enabled just contains symlinks to files in sites-available.

The conf file you posted was missing more than just that one line. I recommend you check the variables in your .php file and re-run the installer.

After turning on the enforce SSL in the passbolt.php and clearing my cache for the last hour so the passbolt page would load properly. The site seems to be redirecting. I have checked it on my chrome which I dont use for passbolt in the office and when I did http://… it redirects to https.

Thanks,