Anyone know where this url with the http prefix is set?  I can't find it in my settings file or in any of the config pages.

 

https v http

Comments

gisle’s picture

The automatic redirect to an URL secured with Transport Layer Security (TLS) is set in the configuration for your webserver (e.g. Apache2).

- gisle

HeneryH’s picture

We aren't on the same page here...

That Drupal Config Page screen is setting the default homepage for the Drupal instance.  See the attached image.

It is clearly pulling a base URL from somewhere and it is pulling the http flavor.

Do you know where that base url is getting its value from?

gisle’s picture

I'll try: again: If you're asking about the part of the string that is not editable (i.e. "http:/www.[redacted].[redacted]" in your screenshot. This is what the code looks like:

'#field_prefix' => $this->requestContext->getCompleteBaseUrl(),

I'm not sure that this is what you're asking about, but it is my best shot.

I suspect it is pulling in the global $base_url. See the API: https://api.drupal.org/api/drupal/core%21globals.api.php/global/base_url/10.

- gisle

HeneryH’s picture

Yes, that is what I am asking.  Odd that I would need to use some API to modify that on a straight up initial build.

HeneryH’s picture

I am running an Nginx reverse proxy that does my certificates and that is set up to proxy to port 80...

###############################################
# Virtual Host configuration for my drupal install.
#
server {
    server_name my_domain.com www.my_domain.com sub1.my_domain.com sub2.my_domain.gop sub3.my_domain.com ;

    listen [::]:443 ssl proxy_protocol; # managed by Certbot
    listen 443 ssl proxy_protocol; # managed by Certbot
    ssl_certificate /etc/letsencrypt/live/xxxx/fullchain.pem; # managed by Certbot
    ssl_certificate_key /etc/letsencrypt/live/xxxx/privkey.pem; # managed by Certbot
    include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
    ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot

    real_ip_header proxy_protocol;
    proxy_set_header X-Real-IP       $proxy_protocol_addr;
    proxy_set_header X-Forwarded-Proto $scheme;
    add_header 'Content-Security-Policy' 'upgrade-insecure-requests';

    location / {
            proxy_set_header Host            $host;
            proxy_set_header X-Real-IP       $proxy_protocol_addr;
            proxy_set_header X-Forwarded-For $proxy_protocol_addr;
            proxy_set_header Upgrade    $http_upgrade;
            proxy_set_header Connection “upgrade”;
            proxy_pass http://10.220.127.232:80/;
    }

So, maybe by the time Drupal detects the URL it is only sensing the http flavor that was proxy_passed to it.

HeneryH’s picture

I think I fixed it by tweaking my nginx reverse proxy server block

    location / {
            proxy_set_header Host            $host;
            proxy_set_header X-Real-IP       $proxy_protocol_addr;
            proxy_set_header X-Forwarded-For $proxy_protocol_addr;
            proxy_set_header X-Forwarded-Host $host;
            proxy_set_header X-Forwarded-Port $server_port;
            proxy_set_header X-Forwarded-Proto $scheme;
            proxy_set_header Upgrade    $http_upgrade;
            proxy_set_header Connection “upgrade”;
            proxy_buffering off;
            proxy_pass http://10.220.127.232:80/;
    }