Score:0

nginx GET request with internal server name instead of public domain name

sa flag

I have set up a nginx reverse proxy with Ubuntu Server 22.04 LTS. The Abacus web application should be accessible with https://abacus.contoso.com from the internet. The internal server name is srv06. My current config looks like this (that's basically the official template from Abacus):

server {
    listen 443 ssl;
    server_name abacus.contoso.com;

    ssl_certificate /etc/nginx/ssl_certs/cert.pem;
    ssl_certificate_key /etc/nginx/ssl_certs/cert.key;

    ssl_session_cache    shared:SSL:1m;
    ssl_session_timeout  5m;

    ssl_ciphers  HIGH:!aNULL:!MD5;
    ssl_protocols TLSv1.2;
    ssl_prefer_server_ciphers  on;

    location / {
            root   html;
            index  index.html index.htm;
            resolver 127.0.0.53;
            proxy_pass https://abacus.contoso.com:40001$uri$is_args$query_string;
            proxy_redirect https://abacus.contoso.com:40001/ https://$host/;
            proxy_set_header Host abacus.contoso.com;

            client_max_body_size 0;
            proxy_connect_timeout 90s;
            proxy_send_timeout 90s;
            proxy_read_timeout 90s;
            send_timeout 90s;
    }
}

The website is accessible and login works basically. The problem is the web application which is started over the website itself. After login an .abalink file is downloaded and started with the software AbaClient. This AbaClient tries to access the server with the URI https://abacus.contoso.com over the proxy - which is correct - but it seems that nginx or the internal server answers the request with the internal server name srv06 instead of the domain name. This is the error message I get: "GET request to the Abacus server failed (srv06)".

Is there something missing in my code? I am relatively new to nginx so I hope that somebody can help me.

Thank you!

Score:0
br flag

I'm not sure why one would use this overcomplicated proxy settings instead of simple default one.

Try this:

    location / {
            proxy_pass https://abacus.contoso.com:40001;
            proxy_set_header Host abacus.contoso.com;

            client_max_body_size 0;
            proxy_connect_timeout 90s;
            proxy_send_timeout 90s;
            proxy_read_timeout 90s;
            send_timeout 90s;
    }
Fabmic96 avatar
sa flag
Okay, the good news is that your config works, so thank you for that! I can't understand why the official template is so much more complicated. The bad news is that it doesn't work with this config either, I still get the same error. It's still trying to connect to the internal server name srv06.
Fabmic96 avatar
sa flag
That's the content of the downloaded abalink file. Do you see anything in there that could cause the issue? `{"application":"AbaLaunch","filetype":"abalink","link":"https://abacus.contoso.com/ulc/application/link?ulcURI=ulcmenu&OAuthCode=OBF%3AKB44C9DCXAXYTCT2HJVE0B0KPN59VS29W7YS3PETYV1193TEDZ69KSJ2AXU9X5MTY9KP0VPYXBSAHAB7XBW1SX4ESDT1L3MXYZ5V3P0X1YMK8X2E88BXTJ6645V3F6C4&redirectURI=%2Fabastart"}`
br flag
@Fabmic96 there is nothing in the nginx config that could change hostname to `srv06`. So probably you have to configure your application correctly to send response with right hostname.
Fabmic96 avatar
sa flag
Okay, I talked to the person who maintains the application server and it seems that it was indeed a fault on the server side so nginx was already configured correctly. Nonetheless thank you for your responses!
I sit in a Tesla and translated this thread with Ai:

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.