Welcome! Log In Create A New Profile

Advanced

Configure https to http with proxy_pass

Posted by philippen 
Configure https to http with proxy_pass
May 29, 2012 01:30PM
Hi,

I am trying to setup the following configuration.

I have two servers that sits behind an nginx load balancer.

So far this works well.

upstream load_balanced {
ip_hash;
server adress_of_server_A;
server adress_of_server_B;
}

server {
listen 80;
listen 8080;

location / {
proxy_pass http://load_balanced;
}
}

The proxy pass works.

However things get a little bit out of hand when I try to add the ssl support. The goal is to allow Nginx load balancer to be accessed via htttps, but then I want Nginx to access the load balanced server via regular http.

server {
listen 80;
listen 8080;
listen 443;

ssl on;
ssl_certificate dummy.crt;
ssl_certificate_key dummy.key;

location / {
proxy_pass http://load_balanced;
}
}

However this leads to host not reachable when accessing via https and when accessing via http it tells me:
<html>
<head><title>400 The plain HTTP request was sent to HTTPS port</title></head>
<body bgcolor="white">
<center><h1>400 Bad Request</h1></center>
<center>The plain HTTP request was sent to HTTPS port</center>
<hr><center>nginx/1.2.0</center>
</body>
</html>

Any ideas how I could achieve this?

Thank you
Re: Configure https to http with proxy_pass
May 29, 2012 05:07PM
Got it!

First, I can't use listen 80; and ssl on altogether.
Second, the port 443 was not open on the EC2 instance.
Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 143
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready