By AlexS

2018-04-16 11:15:12 8 Comments

I have a small problem with redirecting everything from http to https. Here is the setup of my environment:

The server is a docker host which runs multiple docker containers. I'm trying to access a container that listens on port 9000. so I have a ProxyPass in the vhost file that looks like this:

<VirtualHost *:80>
    ProxyPreserveHost On
    ProxyPass / http://localhost:9000/
    ProxyPassReverse / http://localhost:9000/
    Redirect /

The SSL Certificate is issued by AWS. This server is behind a AWS Load Balancer. From the load balancer I have 2 target groups. One is redirecting 80 to 80, and the other 443 to 443.

Right now the is throwing 502 bad gateway error.

Could someone have any idea what the issue here might be? Thanks in advance!


@AlexS 2018-04-16 13:14:21

I've tried adding this to the vhosts file:

RewriteEngine On
RewriteCond %{HTTP:X-Forwarded-Proto} =http
RewriteRule .* https://%{}%{REQUEST_URI} [L,R=permanent]

as indicated in the aws documentation. It doesn't work, I get an error saying invalid redirect. No idea what the problem is.

Anyone else experienced this problem?

@GE ownt 2018-04-16 11:21:08

Does this help:
It seems like you need to redirect permanent.

@AlexS 2018-04-16 11:30:21

I've changed the target groups. Created only one, HTTP on port 80. And added 2 listeners on the load balancer, one 80 and one 443 both set on the same target group. Now, http and https work. But the redirect is not happening. I've enabled mod_rewrite, mod_ssl, I'm thinking something in my vhosts.conf is wrong.

Related Questions

Sponsored Content

1 Answered Questions

[SOLVED] AWS ALB redirect to https

4 Answered Questions

[SOLVED] HTTP to HTTPS Redirects for AWS ELB and Tomcat7 server

8 Answered Questions

[SOLVED] HTTP status code for update and delete?

31 Answered Questions

[SOLVED] How to manage a redirect request after a jQuery Ajax call

2 Answered Questions

[SOLVED] Redirecting AWS ELB HTTP Requests to HTTPS

6 Answered Questions

[SOLVED] How do I redirect with JavaScript?

  • 2011-01-20 08:08:18
  • Ms_Lucky13
  • 1314908 View
  • 889 Score
  • 6 Answer
  • Tags:   javascript redirect

1 Answered Questions

1 Answered Questions

1 Answered Questions

[SOLVED] Glassfish HTTPS redirect behind SSL offloader and Apache

Sponsored Content