# Beginner questions about proxy configuration and white space

**URL:** <https://www.ruby-forum.com/t/beginner-questions-about-proxy-configuration-and-white-space/211604>\
**Category:** NGINX\
**Created:** [September 8, 2011, 4:42pm UTC](https://www.ruby-forum.com/t/beginner-questions-about-proxy-configuration-and-white-space/211604 "2011-09-08T16:42:26Z")\
**Posts on this page:** 8\
**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:** [September 8, 2011, 4:42pm UTC](https://www.ruby-forum.com/t/beginner-questions-about-proxy-configuration-and-white-space/211604/1 "2011-09-08T16:42:26Z")

</div>

Hello,

I have installed nginx on my personal computer and would like to use it  
as a proxy to force authentication via modified http headers in various  
browsers. There’s an add-on in firefox to do this, but none for Chrome,  
which is why I am using nginx. I’ve edited configuration file to include  
something like this under the http section:

server {  
listen some\_port;

location http://some\_ip {  
add\_header X-h1 h1;  
add\_header X-h2 h2 h2;  
add\_header X-h3 h3;  
add\_header X-h4 h4;  
add\_header X-h5 h5;  
add\_header X-h6 h6 h6;  
add\_header X-h7 h7;  
}  
}

I figured that out from reading many examples and the wiki. Now, I do  
not know how exactly to configure nginx to act as a proxy. I’ve read  
through part of the wiki on the HttpProxy module, but I don’t have much  
experience with web servers or proxies. Could someone point me in the  
right direction?

Also, when editing the configuration file using the http headers module  
(this: [Module ngx\_http\_headers\_module](http://wiki.nginx.org/HttpHeadersModule)), can values have spaces  
in them? Or should I put quotations around the whole thing? I read here:  
[How to Configure NGINX | Linode Docs](http://library.linode.com/web-servers/nginx/configuration/basic) that  
whitespace doesn’t matter, but I just thought to double check, since I  
saw no examples where values had spaces in them.

Thanks.

Posted at Nginx Forum:

> **[Beginner questions about proxy configuration and white space](https://forum.nginx.org/read.php?2,214982,214982#msg-214982)**
>
> Hello, I have installed nginx on my personal computer and would like to use it as a proxy to force authentication via modified http headers in various browsers. There's an add-on in firefox to do this, but none for Chrome, which is why I am using...

---

<div class="post-metadata">

**Author:** ![ynasser](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/y/fbc32d/32.png) [@ynasser](https://www.ruby-forum.com/u/ynasser)\
**Post date:** [September 8, 2011, 7:29pm UTC](https://www.ruby-forum.com/t/beginner-questions-about-proxy-configuration-and-white-space/211604/2 "2011-09-08T19:29:04Z")

</div>

proxy:

server {  
listen some\_ip:some\_port default;

location / {  
add\_header X-h1 h1;  
add\_header X-h2 “h2 h2”;  
add\_header X-h3 h3;  
add\_header X-h4 h4;  
add\_header X-h5 h5;  
add\_header X-h6 “h6 h6”;  
add\_header X-h7 h7;  
proxy\_pass [http://backend](http://backend);  
}  
}

space: add a double quotes  
add\_header X-h2 “h2 h2”;

MagicBear

Posted at Nginx Forum:

> **[Re: Beginner questions about proxy configuration and white space](https://forum.nginx.org/read.php?2,214982,214984#msg-214984)**
>
> Hello, I have installed nginx on my personal computer and would like to use it as a proxy to force authentication via modified http headers in various browsers. There's an add-on in firefox to do this, but none for Chrome, which is why I am using...

---

<div class="post-metadata">

**Author:** ![ynasser](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/y/fbc32d/32.png) [@ynasser](https://www.ruby-forum.com/u/ynasser)\
**Post date:** [September 8, 2011, 7:42pm UTC](https://www.ruby-forum.com/t/beginner-questions-about-proxy-configuration-and-white-space/211604/3 "2011-09-08T19:42:43Z")

</div>

I’ll try that out.

Thank you!

Posted at Nginx Forum:

> **[Re: Beginner questions about proxy configuration and white space](https://forum.nginx.org/read.php?2,214982,214986#msg-214986)**
>
> Hello, I have installed nginx on my personal computer and would like to use it as a proxy to force authentication via modified http headers in various browsers. There's an add-on in firefox to do this, but none for Chrome, which is why I am using...

---

<div class="post-metadata">

**Author:** ![ynasser](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/y/fbc32d/32.png) [@ynasser](https://www.ruby-forum.com/u/ynasser)\
**Post date:** [September 9, 2011, 10:08pm UTC](https://www.ruby-forum.com/t/beginner-questions-about-proxy-configuration-and-white-space/211604/4 "2011-09-09T22:08:43Z")

</div>

if you are running nginx, you may use “nginx -s reload” to reload the  
config.  
or killall -9 nginx; nginx to restart nginx

2011/9/10 ynasser [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)

---

<div class="post-metadata">

**Author:** ![ynasser](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/y/fbc32d/32.png) [@ynasser](https://www.ruby-forum.com/u/ynasser)\
**Post date:** [September 9, 2011, 11:01pm UTC](https://www.ruby-forum.com/t/beginner-questions-about-proxy-configuration-and-white-space/211604/5 "2011-09-09T23:01:15Z")

</div>

I don’t think it’s a problem with reloading the configuration file,  
because I have been reloading it every time after I update and save it.

What is happening is that when I run ‘sudo nginx’, it doesn’t start and  
outputs this error:

nginx: [emerg] bind() to some\_ip:some\_port failed (49: Can’t assign  
requested address)

I can access some\_ip:some\_port just fine from a browser and ssh-ing into  
it is not a problem.

Posted at Nginx Forum:

> **[Re: Beginner questions about proxy configuration and white space](https://forum.nginx.org/read.php?2,214982,215044#msg-215044)**
>
> Hello, I have installed nginx on my personal computer and would like to use it as a proxy to force authentication via modified http headers in various browsers. There's an add-on in firefox to do this, but none for Chrome, which is why I am using...

---

<div class="post-metadata">

**Author:** ![ynasser](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/y/fbc32d/32.png) [@ynasser](https://www.ruby-forum.com/u/ynasser)\
**Post date:** [September 10, 2011, 7:23am UTC](https://www.ruby-forum.com/t/beginner-questions-about-proxy-configuration-and-white-space/211604/6 "2011-09-10T07:23:28Z")

</div>

If you only using one ip, you can use listen 80 default;  
The some\_ip:some\_port is using on my product server, it shows no  
problem.

2011/9/10 ynasser [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)

---

<div class="post-metadata">

**Author:** ![ynasser](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/y/fbc32d/32.png) [@ynasser](https://www.ruby-forum.com/u/ynasser)\
**Post date:** [September 12, 2011, 7:22pm UTC](https://www.ruby-forum.com/t/beginner-questions-about-proxy-configuration-and-white-space/211604/7 "2011-09-12T19:22:32Z")

</div>

It works now. My configuration looks like this:

server {  
listen 80 default;

```
location / {
  proxy_pass http://some_ip:some_port;

  proxy_set_header X-h1 h1;
  proxy_set_header X-h2 h2;
  proxy_set_header X-h3 "h3 h3";
  }
}

```

I hope this help anyone else with this problem.

Posted at Nginx Forum:

> **[Re: Beginner questions about proxy configuration and white space](https://forum.nginx.org/read.php?2,214982,215126#msg-215126)**
>
> Hello, I have installed nginx on my personal computer and would like to use it as a proxy to force authentication via modified http headers in various browsers. There's an add-on in firefox to do this, but none for Chrome, which is why I am using...

---

<div class="post-metadata">

**Author:** ![ynasser](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/y/fbc32d/32.png) [@ynasser](https://www.ruby-forum.com/u/ynasser)\
**Post date:** [September 9, 2011, 10:05pm UTC](https://www.ruby-forum.com/t/beginner-questions-about-proxy-configuration-and-white-space/211604/8 "2011-09-09T22:05:38Z")

</div>

I reinstalled nginx and re-added that directive to the new configutation  
file. Now this happens:

> > sudo nginx  
> > nginx: [emerg] bind() to 10.0.1.187:2525 failed (49: Can’t assign  
> > requested address)

In regards to the example given above:

server {  
listen some\_ip:some\_port default;

location / {  
add\_header X-h1 h1;  
add\_header X-h2 “h2 h2”;  
add\_header X-h3 h3;  
add\_header X-h4 h4;  
add\_header X-h5 h5;  
add\_header X-h6 “h6 h6”;  
add\_header X-h7 h7;  
proxy\_pass [http://backend](http://backend);  
}  
}

some\_ip:some\_port is the site that I’m trying to pass the headers to.  
For [http://backend](http://backend), I’m using “[http://127.0.0.1](http://127.0.0.1)”

Any help would be appreciated.

Posted at Nginx Forum:  
[http://forum.nginx.org/read.php?2,214982,215040#msg-215040](http://forum.nginx.org/read.php?2,214982,215040#msg-215040)
