Ilisei Boliev2018-03-18 13:26:20
Apache HTTP Server
Ilisei Boliev, 2018-03-18 13:26:20

Apache http>https when using port forwarding on modem?

Good afternoon everyone, I'm writing here because I don't understand anything anymore. Hope for enlightenment. The situation is as follows, I decided to deploy nextcloud for friends of acquaintances. I set everything up, it works inside. Created a certificate, everything answers. Then I started setting up port forwarding (the modem that comes with gpon is included), and then I had a question. Ideally, I would like that when I drive in the address into the browser line, it will immediately forward to port 443 inside, but in reality I get the following. When I drive in the address: port (for port 80), I fail at 80. When I drive in the address: port (for 443), I fail only if I write HTTPS first, otherwise bad request. Also, if I set up a redirect to apache, I check everything works inside, there’s no way outside, that is, I go outside on port 80, it forwards to 81 inside (configured and checked inside), and nothing.servername I failed at https://servername. Everything is deployed on arch + LAMP + nextcloud. The redirect is configured through the .htaccess file, with the following lines
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{SERVER_NAME}/$1 [R,L]
UPD as far as I understand all the problems due to the fact that apache returns a 400 error , when accessing port 443 directly.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
Saboteur, 2018-03-18

so what do you want.
Make a redirect from http 80 to https 443 already using apache, not a router (add a virtual host on port 80 with a redirect to https)
http and https - as if they are different protocols, redirection at the port level should not work. You can also raise http to 443 - from where the router should guess about this.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question