Score:0

Can not redirect https with upstream directive

ph flag

With such config a I get redirecting to google.com

server {
    listen 80;

    proxy_ssl_server_name on;
    rewrite_log on;

    location / {
        proxy_pass https://google.com;
    }
}

but if I add upstream instead of host

upstream some-backend {
    server google.com:443;
}

server {
    listen 80;

    proxy_ssl_server_name on;
    rewrite_log on;

    location / {
        proxy_pass https://some-backend;
    }
}

I am getting error from googleenter image description here

jp flag
What url is showing in browser vs what you attemped?
Artem avatar
ph flag
@dmr83457 I attemped http://localhost:8080/reqwrqwwerq In browser showed http://localhost:8080/reqwrqwwerq Also I used curl curl -i localhost:8080/ and this commad return google page with 404 error
Artem avatar
ph flag
I did repository with that https://github.com/ArtemMe/devops_drafts/tree/master/nginx
Score:0
ph flag

It is because of fqdn. On the server is sent ip instead of fqdn. You can fix it with that config:

upstream google.com {
    server 10.16.1.51:443;
}

...
proxy_pass https://google.com;
proxy_ssl_server_name on;

or you can manually set headers in location section:

location / {
    proxy_pass https://some-backend;
    proxy_ssl_server_name on;
    proxy_ssl_name google.com;
    proxy_set_header Host google.com;
}
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.