0

I am attempting to secure the admin pages (/admin/*) and login page (/user/login) to port 8443. I have successfully done that with the following in apache 2.4:

<VirtualHost _default_:443>
    ServerName example.com:443
    ServerAlias drupal
    DocumentRoot "/opt/rh/httpd24/root/var/www/html/example.com/current"
    <LocationMatch /(user|admin)>
            Require all denied
    </LocationMatch>
</VirtualHost>

<VirtualHost *:8443>
    ServerName example.com:8443
    ServerAlias drupal
    DocumentRoot "/opt/rh/httpd24/root/var/www/html/example.com/current"
</VirtualHost>

The problem I am having is when I go to https://www.example.com:8443/user/login and login, I am redirected to http://www.example.com:8443/user/1.

This creates a 400 error - Bad request. Trying to serve http content over a SSL port.

How do I tell drupal to stay on https protocol and remain on port 8443?

4
  • 1
    You could use one of the login redirect modules to define where you wanna get redirected to after login, for example to /admin/content.
    – leymannx
    Jul 15, 2019 at 18:32
  • 2
    Thanks. I would prefer if there's a solution in apache. If not I will try this. Jul 15, 2019 at 18:42
  • Regarding Apache you are better off asking on Stack Overflow I guess. As that's off-topic on Drupal Answers.
    – leymannx
    Jul 15, 2019 at 18:53
  • What I read on there was simply code the request to go to https. Since this is a core form, I am not able to easily rewrite where the request is going. Jul 15, 2019 at 20:03

1 Answer 1

0

So I wasn't able to do this on a separate port, but for anyone who needs to secure the login page from public eye, this is what I did.

<VirtualHost _default_:443>
  ServerName example.com:443
  ServerAlias drupal
  DocumentRoot "/opt/rh/httpd24/root/var/www/html/example.com/current"
  <LocationMatch /(user|admin)>
        Require all denied
        Require ip 10
  </LocationMatch>
</VirtualHost>

This will require the user to be on a local IP. (I am in-housing the site, so when I access the site I'm on a local IP.)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.