# Nginx Reverse proxy + RD Gateway Auth Problem

**URL:** <https://www.ruby-forum.com/t/nginx-reverse-proxy-rd-gateway-auth-problem/232602>\
**Category:** NGINX\
**Created:** [October 17, 2014, 2:24pm UTC](https://www.ruby-forum.com/t/nginx-reverse-proxy-rd-gateway-auth-problem/232602 "2014-10-17T14:24:55Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![addis\_a](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/c4cdca/32.png) [@addis\_a](https://www.ruby-forum.com/u/addis_a)\
**Post date:** [October 17, 2014, 2:24pm UTC](https://www.ruby-forum.com/t/nginx-reverse-proxy-rd-gateway-auth-problem/232602/1 "2014-10-17T14:24:55Z")

</div>

Hello all,

Nginx is the reverse proxy+ MS Remote Desktop Gateway using SSL, the  
first  
authentication is working, the problem is when I try to open a program  
in  
this environment for example wordpad.exe of session host RD, it ask for  
user and password (I use the same credentials used to connect in RD  
Gateway), when the credentials are filled up again, I get the message  
user  
or password are wrong.

My .conf for the context:

```
 location /RDWeb { <--- the same context context in IIS
    proxy_pass https://server.domain/RDWeb;
    proxy_set_header Accept-Encoding "";
    proxy_set_header host server.domain;
 }

 location /rpc { <-- the same context context in IIS
    proxy_pass http://server.domain/rpc;
 }

```

In the log of nginx with debug mode on, show this information:

2014/10/17 09:06:02 [info] 20589#0: \*43 client x.x.x.x closed keepalive  
connection(this is the only message)

Any help will be appreciated, thank you!

Posted at Nginx Forum:

> **[Nginx Reverse proxy + RD Gateway Auth Problem](https://forum.nginx.org/read.php?2,254095,254095#msg-254095)**
>
> Hello all, Nginx is the reverse proxy+ MS Remote Desktop Gateway using SSL, the first authentication is working, the problem is when I try to open a program in this environment for example wordpad.exe of session host RD, it ask for user and password...

---

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [October 17, 2014, 2:55pm UTC](https://www.ruby-forum.com/t/nginx-reverse-proxy-rd-gateway-auth-problem/232602/2 "2014-10-17T14:55:52Z")

</div>

Hello!

On Fri, Oct 17, 2014 at 08:24:18AM -0400, timbo wrote:

> Hello all,
> 
> Nginx is the reverse proxy+ MS Remote Desktop Gateway using SSL, the first  
> authentication is working, the problem is when I try to open a program in  
> this environment for example wordpad.exe of session host RD, it ask for  
> user and password (I use the same credentials used to connect in RD  
> Gateway), when the credentials are filled up again, I get the message user  
> or password are wrong.

Make sure that Basic authentication is used, not NTLM aka  
Integrated Windows Authentication. The latter has problem with  
proxy servers due to it’s connection-oriented design, and will not  
work though nginx.

> **[Integrated Windows Authentication](https://en.wikipedia.org/wiki/Integrated_Windows_Authentication)**
>
> Integrated Windows Authentication (IWA)
> is a term associated with Microsoft products that refers to the SPNEGO, Kerberos, and NTLMSSP authentication protocols with respect to SSPI functionality introduced with Microsoft Windows 2000 and included with later Windows NT-based operating systems. The term is used more commonly for the automatically authenticated connections between Microsoft Internet Information Services, Internet Explorer, and other Active Directory aware applications.
> IWA is also k...

–  
Maxim D.  
[http://nginx.org/](http://nginx.org/)

---

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [December 2, 2015, 8:40am UTC](https://www.ruby-forum.com/t/nginx-reverse-proxy-rd-gateway-auth-problem/232602/3 "2015-12-02T08:40:59Z")

</div>

Hi timbo,

I am also trying to connect to a Remote Desktop Gateway through nginx.  
Did  
you get it work?

Regards,  
Fred

Posted at Nginx Forum:

> **[Re: Nginx Reverse proxy + RD Gateway Auth Problem](https://forum.nginx.org/read.php?2,254095,263116#msg-263116)**
>
> Hello all, Nginx is the reverse proxy+ MS Remote Desktop Gateway using SSL, the first authentication is working, the problem is when I try to open a program in this environment for example wordpad.exe of session host RD, it ask for user and password...

---

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [October 17, 2014, 4:10pm UTC](https://www.ruby-forum.com/t/nginx-reverse-proxy-rd-gateway-auth-problem/232602/4 "2014-10-17T16:10:18Z")

</div>

Thank you very much Maxim, I will check your recommendation I will post  
the  
results here.

Posted at Nginx Forum:

> **[Re: Nginx Reverse proxy + RD Gateway Auth Problem](https://forum.nginx.org/read.php?2,254095,254105#msg-254105)**
>
> Hello all, Nginx is the reverse proxy+ MS Remote Desktop Gateway using SSL, the first authentication is working, the problem is when I try to open a program in this environment for example wordpad.exe of session host RD, it ask for user and password...

---

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [December 2, 2015, 9:51am UTC](https://www.ruby-forum.com/t/nginx-reverse-proxy-rd-gateway-auth-problem/232602/5 "2015-12-02T09:51:47Z")

</div>

Hi, sorry, but I don’t understand what you mean with stream {}, my nginx  
config for the RD Gateway is the following:

```
server {listen *:6080; listen *:6443 ssl;
server_name ~^rdg..*$; include ssl_rdg.conf;
location / {proxy_pass https://s2012-rdg; include

```

proxy\_defaults.conf;}}

Should I replace proxy\_pass to stream?

Regards,  
Fred

Posted at Nginx Forum:

> **[Re: Nginx Reverse proxy + RD Gateway Auth Problem](https://forum.nginx.org/read.php?2,254095,263118#msg-263118)**
>
> Hello all, Nginx is the reverse proxy+ MS Remote Desktop Gateway using SSL, the first authentication is working, the problem is when I try to open a program in this environment for example wordpad.exe of session host RD, it ask for user and password...

---

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [December 2, 2015, 9:45am UTC](https://www.ruby-forum.com/t/nginx-reverse-proxy-rd-gateway-auth-problem/232602/6 "2015-12-02T09:45:56Z")

</div>

## frederico Wrote:

> Hi timbo,
> 
> I am also trying to connect to a Remote Desktop Gateway through nginx.  
> Did you get it work?

Have you tried this using stream {} ? which works fine for vpn and other  
streaming services.

Posted at Nginx Forum:

> **[Re: Nginx Reverse proxy + RD Gateway Auth Problem](https://forum.nginx.org/read.php?2,254095,263117#msg-263117)**
>
> Hello all, Nginx is the reverse proxy+ MS Remote Desktop Gateway using SSL, the first authentication is working, the problem is when I try to open a program in this environment for example wordpad.exe of session host RD, it ask for user and password...

---

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [December 2, 2015, 6:16pm UTC](https://www.ruby-forum.com/t/nginx-reverse-proxy-rd-gateway-auth-problem/232602/7 "2015-12-02T18:16:00Z")

</div>

Hi,

I’ve tried a lot of commands, stream is not recognized and I don’t think  
it’s possible to make it work. nginx need a certificate and RD Gateway  
need  
also a certificate, so there are 2 SSL connection between the client and  
the  
server, it’s can’t work.

I also tried with the same certificate on the 2 connections, but without  
success… ☹

Regards,  
Fred

Posted at Nginx Forum:

> **[Re: Nginx Reverse proxy + RD Gateway Auth Problem](https://forum.nginx.org/read.php?2,254095,263214#msg-263214)**
>
> Hello all, Nginx is the reverse proxy+ MS Remote Desktop Gateway using SSL, the first authentication is working, the problem is when I try to open a program in this environment for example wordpad.exe of session host RD, it ask for user and password...

---

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [December 2, 2015, 10:50am UTC](https://www.ruby-forum.com/t/nginx-reverse-proxy-rd-gateway-auth-problem/232602/8 "2015-12-02T10:50:49Z")

</div>

frederico Wrote:

---

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [December 2, 2015, 6:26pm UTC](https://www.ruby-forum.com/t/nginx-reverse-proxy-rd-gateway-auth-problem/232602/9 "2015-12-02T18:26:31Z")

</div>

## frederico Wrote:

> Hi,
> 
> I’ve tried a lot of commands, stream is not recognized and I don’t  
> think it’s possible to make it work. nginx need a certificate and RD  
> Gateway need also a certificate, so there are 2 SSL connection between  
> the client and the server, it’s can’t work.

Then you have tried the wrong version:  
[http://nginx.org/en/docs/stream/ngx\_stream\_ssl\_module.html](http://nginx.org/en/docs/stream/ngx_stream_ssl_module.html)  
[http://nginx.org/en/docs/stream/ngx\_stream\_proxy\_module.html#proxy\_pass](http://nginx.org/en/docs/stream/ngx_stream_proxy_module.html#proxy_pass)

Posted at Nginx Forum:

> **[Re: Nginx Reverse proxy + RD Gateway Auth Problem](https://forum.nginx.org/read.php?2,254095,263215#msg-263215)**
>
> Hello all, Nginx is the reverse proxy+ MS Remote Desktop Gateway using SSL, the first authentication is working, the problem is when I try to open a program in this environment for example wordpad.exe of session host RD, it ask for user and password...
