Https:// suddenly redirecting to http://

Part 1.
HCP v1.8.12
domain valid.
Let’s Encrypt SSL installed - and previously worked.
https://apps.cleverapps.online/sales-manager/ quickly redirects to http:// and is unsecure.

Part 2.
This domain hosts a React Web app I am developing with assistance from Claude.ai. (just fyi)

Claude has recommended change to Apache2 config:

# Force HTTPS for the entire domain
<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteCond %{HTTPS} off
    RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
</IfModule>

# Proxy configuration
<Location /sales-manager>
    SSLProxyEngine On
    ProxyPass http://localhost:3001/
    ProxyPassReverse http://localhost:3001/
    RequestHeader set X-Forwarded-Proto "https"
    RequestHeader set X-Forwarded-Port "443"
    ProxyPreserveHost On
</Location>

# Additional SSL Headers
<IfModule mod_headers.c>
    Header always set Strict-Transport-Security "max-age=31536000; includeSubDomains"
</IfModule>

And to add proxy extensions settings:

/sales-manager proxy:localhost:3001

The Proxy Extension I can do in HCP Web. The change to the Apache2 config for the domain app.cleverapps.online I have no idea where to edit/place.

Any ideas guys? Thank you!
Edward

I guess the issue is not Apache2 but Nginx.

Show the output of this command (replace YourUser by the actual user):

v-list-web-domain YourUser apps.cleverapps.online json
1 Like

Hi @sahsanu.

{
    "apps.cleverapps.online": {
        "IP": "5.161.116.39",
        "IP6": "",
        "DOCUMENT_ROOT": "/home/edwardc/web/apps.cleverapps.online/public_html/",
        "U_DISK": "3045",
        "U_BANDWIDTH": "0",
        "TPL": "default",
        "ALIAS": "",
        "STATS": "",
        "STATS_USER": "",
        "SSL": "yes",
        "SSL_FORCE": "yes",
        "SSL_HSTS": "",
        "SSL_HOME": "same",
        "LETSENCRYPT": "yes",
        "FTP_USER": "",
        "FTP_PATH": "",
        "AUTH_USER": "",
        "BACKEND": "default",
        "PROXY": "hosting",
        "PROXY_EXT": "css,htm,html,js,json,xml,apng,avif,bmp,cur,gif,ico,jfif,jpg,jpeg,pjp,pjpeg,png,svg,tif,tiff,webp,aac,caf,flac,m4a,midi,mp3,ogg,opus,wav,3gp,av1,avi,m4v,mkv,mov,mpg,mpeg,mp4,mp4v,webm,otf,ttf,woff,woff2,doc,docx,odf,odp,ods,odt,pdf,ppt,pptx,rtf,txt,xls,xlsx,7z,bz2,gz,rar,tar,tgz,zip,apk,appx,bin,dmg,exe,img,iso,jar,msi,webmanifest,/sales-manager/,proxy:https://localhost:3001/",
        "FASTCGI_CACHE": "no",
        "FASTCGI_DURATION": "0s",
        "REDIRECT": "",
        "REDIRECT_CODE": "",
        "CUSTOM_DOCROOT": "",
        "SUSPENDED": "no",
        "TIME": "20:01:10",
        "DATE": "2024-10-22"
    }
}

That looks fine.

Show the output of these commands (replace YourUser):

ls -l /home/YourUser/conf/web/apps.cleverapps.online/
cat /home/YourUser/conf/web/apps.cleverapps.online/nginx.forcessl.conf
ls -l /home/edwardc/conf/web/apps.cleverapps.online/
total 28
-rw-r----- 1 root edwardc 1735 Nov 16 11:39 apache2.conf
-rw-r----- 1 root edwardc 2016 Nov 16 11:39 apache2.ssl.conf
-rw-r----- 1 root edwardc    0 Nov 17 18:41 nginx.conf
-rw-r--r-- 1 root root     159 Oct 24 11:33 nginx.conf_letsencrypt
-rw-r----- 1 root edwardc   38 Nov 17 18:41 nginx.forcessl.conf
-rw-r----- 1 root edwardc    0 Nov 17 18:41 nginx.ssl.conf
lrwxrwxrwx 1 root root      68 Oct 24 11:26 nginx.ssl.conf_letsencrypt -> /home/edwardc/conf/web/apps.cleverapps.online/nginx.conf_letsencrypt
-rw-r--r-- 1 root root     721 Nov  3 15:13 php.ini
drwxr-xr-x 2 root root    4096 Oct 24 11:33 ssl
cat /home/edwardc/conf/web/apps.cleverapps.online/nginx.forcessl.conf

return 301 https://$host$request_uri;

Did you realize nginx.conf and nginx.ssl.conf are empty?

Could you please rebuild your domain?

v-rebuild-web-domain edwardc apps.cleverapps.online yes

Odd. I blame Claude.ai

sed: -e expression #16, char 355: unknown option to `s'
sed: -e expression #16, char 355: unknown option to `s'
sed: -e expression #16, char 355: unknown option to `s'
sed: -e expression #16, char 355: unknown option to `s'

Also, https:// to http:// issue still exists.

Did you modify the template hosting?

Debug the command and show the output (the output will be large so you should share it using some site like pastebin or similar):

bash -x /usr/local/hestia/bin/v-rebuild-web-domain edwardc apps.cleverapps.online yes

I think this is what you have asked for… wow… thank you for your kind assistance

https://pastebin.com/wD4hrufj

Remove that from proxy extensions, that is causing the errors.

1 Like

Done. Removed those proxy extensions and https:// is working again.

Thank you.

2 Likes

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.