# Nginx reverse proxy issue

**URL:** <https://www.ruby-forum.com/t/nginx-reverse-proxy-issue/202299>\
**Category:** NGINX\
**Created:** [January 26, 2011, 2:38pm UTC](https://www.ruby-forum.com/t/nginx-reverse-proxy-issue/202299 "2011-01-26T14:38:02Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![luislavena](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/0ea827/32.png) [@luislavena](https://www.ruby-forum.com/u/luislavena)\
**Post date:** [January 26, 2011, 2:38pm UTC](https://www.ruby-forum.com/t/nginx-reverse-proxy-issue/202299/1 "2011-01-26T14:38:02Z")

</div>

Hello all,

For the last few days Ive been trying Nginx as a reverse proxy in front  
of an IIS webserver with an [ASP.NET](http://ASP.NET) webapp.

From the Nginx configuration:

location / { proxy\_pass [http://theproxiedserver/somepath](http://theproxiedserver/somepath); }

When I visit [http://nginx](http://nginx) I see an error generated by theproxiedserver;  
from this I conclude that the basic proxying is working. The error more  
or less tells me the ASP application has issues fetching its URL. Can I  
somehow convince Nginx to work around this issue? The IIS server is a  
blackbox, no modifications can be made there. My stracktrace:

At X. Suite.ASP.ASPInstance…ctor(String strRootURL)

at X.Suite.General.GetASPInstanceID()

at X.Suite.iPortal.Skin.Global\_asax.InitializeApplication()

at X.Suite.iPortal.Skin.Global\_asax.Application\_BeginRequest(Object  
sender, EventArgs e)

at  
System.Web.HttpApplication.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()

at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean&  
completedSynchronously)

Best, Robin

---

<div class="post-metadata">

**Author:** ![Robin\_Diederen](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/76d3ee/32.png) [@Robin\_Diederen](https://www.ruby-forum.com/u/Robin_Diederen)\
**Post date:** [January 26, 2011, 6:38pm UTC](https://www.ruby-forum.com/t/nginx-reverse-proxy-issue/202299/2 "2011-01-26T18:38:09Z")

</div>

Hello Igor,

Thanks so much for your help.

I tried your suggestions but sadly to no result; the [ASP.NET](http://ASP.NET) app returns  
the same result.

Now I’m wondering: when I connect to the IIS server by IP instead of its  
DNS name, I get the same error (only difference is that css works here).  
My guess would be the server is using name based virtual hosting.

So I tried to change the Host value in header to the IIS server’s DNS  
name. When I connect to the IIS server, I am redirected to the IIS  
server.

What could I do to make this work? I presume this is a general error  
regarding reverse proxying with name based virtual hosting?

Best, Robin

-----Original message-----  
To:removed\_email\_address@domain.invalid;  
From:Igor S. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
Sent:Wed 26-01-2011 17:37  
Subject:Re: Nginx reverse proxy issue  
On Wed, Jan 26, 2011 at 02:36:01PM +0100, Robin Diederen wrote:

> When I visit [http://nginx](http://nginx) I see an error generated by theproxiedserver ; from  
> this I conclude that the basic proxying is working. The error more or less tells  
> me the ASP application has issues fetching its URL. Can I somehow convince Nginx  
> to work around this issue? The IIS server is a blackbox, no modifications can be  
> made there. My stracktrace:
> 
> at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean&  
> completedSynchronously)

Probably you need

location / {  
proxy\_pass [http://theproxiedserver/somepath](http://theproxiedserver/somepath);  
proxy\_set\_header Host thepublicservername;

# or

proxy\_set\_header Host $host;  
}

–  
Igor S.

> **[Igor Sysoev](http://sysoev.ru/en/)**

---

<div class="post-metadata">

**Author:** ![Robin\_Diederen](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/76d3ee/32.png) [@Robin\_Diederen](https://www.ruby-forum.com/u/Robin_Diederen)\
**Post date:** [January 26, 2011, 5:35pm UTC](https://www.ruby-forum.com/t/nginx-reverse-proxy-issue/202299/3 "2011-01-26T17:35:21Z")

</div>

On Wed, Jan 26, 2011 at 02:36:01PM +0100, Robin Diederen wrote:

> When I visit [http://nginx](http://nginx) I see an error generated by “theproxiedserver”; from  
> this I conclude that the basic proxying is working. The error more or less tells  
> me the ASP application has issues fetching its URL. Can I somehow convince Nginx  
> to work around this issue? The IIS server is a blackbox, no modifications can be  
> made there. My stracktrace:
> 
> at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean&  
> completedSynchronously)

Probably you need

location / {  
proxy\_pass [http://theproxiedserver/somepath](http://theproxiedserver/somepath);  
proxy\_set\_header Host thepublicservername;  
# or  
proxy\_set\_header Host $host;  
}

–  
Igor S.

> **[Igor Sysoev](http://sysoev.ru/en/)**
