Welcome! Log In Create A New Profile

Advanced

proxy pass to https

Posted by jleylegian 
proxy pass to https
August 17, 2016 02:41PM
I need to proxy requests from nginx to a microservice that has SSL set up.
When I use https I see an error that says: nginx: [emerg] host not found in upstream "service_hosts" in /etc/nginx/conf.d/server.conf:368

When I use http, I don't get the error.

The Nginx server also has SSL turned on and is listening on 443.

Here is a snippet of my configuration:
location /api/service/ {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_set_header X-NginX-Proxy true;

proxy_pass https://service_hosts/api/service/;
proxy_redirect off;

# Handle Web Socket connections
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";

# this is the magic
error_page 405 =200 $uri;

#health_check;
}

Why does it not like https?
Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 313
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 500 on July 15, 2024
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready