D
D
Daniil Muidinov2016-05-03 06:43:40
Nginx
Daniil Muidinov, 2016-05-03 06:43:40

How to proxy HTTPS in Nginx?

Good afternoon,

There is a project progect.com, it works on https. Pictures for the project are physically located on 3 different servers
1. Physically next to progect.com
2. On the server 1.1.1.1
3. On the server 2.2.2.2

The last 2 give them on request https://content.progect.com/img

I collect all with this nginx config

http {
[…]
upstream content {
  server 1.1.1.1:443;
  server 2.2.2.2:443;  
}
server {
listen 443 ssl;
server progect.com;
[…]
location /img {
  try_files $uri @image;	
}

location @image {
  proxy_pass https://content;
  proxy_next_upstream http_404;
  proxy_set_header Host content.progect.com;
}
}
}

In the browser, at the request https://progect.com I get an Unsecure connection. Parts of this page (such as images are not protected)
WSekKeu.png

At the same time, if you remove proxying, then everything is fine, just like https://content.progect.com/img , any picture gives without warning, from both servers

What to change in the config so that the pictures are taken correctly over https and didn't generate this warning in the browser?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
Z
zorruch, 2016-05-03
@DANic

The nginx config is correct
. I would start looking for a solution to the problem by understanding which links on the site are given via http (instead of https) and already looking for a possible problem based on the results.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question