# About resolver and 502 error

**URL:** <https://www.ruby-forum.com/t/about-resolver-and-502-error/222115>\
**Category:** NGINX\
**Created:** [August 13, 2012, 11:21am UTC](https://www.ruby-forum.com/t/about-resolver-and-502-error/222115 "2012-08-13T11:21:23Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![aris](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/258eb7/32.png) [@aris](https://www.ruby-forum.com/u/aris)\
**Post date:** [August 13, 2012, 11:21am UTC](https://www.ruby-forum.com/t/about-resolver-and-502-error/222115/1 "2012-08-13T11:21:23Z")

</div>

hi Guys:

When I run NGINX as a proxy and set a resolver(such as 8.8.8.8), I  
found  
out if DNS fail to resolve, 502 is popped up.  
We can not set two or more DNS entry, so how to handle such situation?

post my configuration as following:

```
            server {
                    listen 80;
                    resolver 8.8.8.8;

                    location / {
                            proxy_pass $scheme://$host$request_uri;
                            proxy_set_header Host $http_host;
                            proxy_buffer_size 128k;
                            proxy_buffers 32 32k;
                            proxy_busy_buffers_size 128k;
                            proxy_buffering off;
                            client_max_body_size 1000m;
                            client_body_buffer_size 256k;
                            proxy_connect_timeout 600;
                            proxy_read_timeout 600;
                            proxy_send_timeout 600;
                            proxy_temp_file_write_size 128k;
                    }
            }

```

some error logs were printed out as following;

2012/08/11 10:43:20 [error] 13297#0: \*183 recv() failed (104: Connection  
reset by peer) while reading response header from upstream, client:  
192.168.52.8, server: , request: “GET  
/complete/search?client=chrome&hl=en-US&q=www. HTTP/1.1”, upstream: "  
[http://74.125.235.197:80/complete/search?client=chrome&hl=en-US&q=www.](http://74.125.235.197:80/complete/search?client=chrome&hl=en-US&q=www.)“,  
host: “[clients1.google.com](http://clients1.google.com)”  
2012/08/11 10:43:21 [error] 13297#0: \*191 recv() failed (104: Connection  
reset by peer) while reading response header from upstream, client:  
192.168.52.8, server: , request: “GET  
/complete/search?client=chrome&hl=en-US&q=www. HTTP/1.1”, upstream: "  
[http://74.125.235.200:80/complete/search?client=chrome&hl=en-US&q=www.](http://74.125.235.200:80/complete/search?client=chrome&hl=en-US&q=www.)”,  
host: “[clients1.google.com](http://clients1.google.com)”  
2012/08/11 10:43:21 [error] 13297#0: \*196 recv() failed (104: Connection  
reset by peer) while reading response header from upstream, client:  
192.168.52.8, server: , request: “GET  
/complete/search?client=chrome&hl=en-US&q=www.g HTTP/1.1”, upstream: "  
[http://74.125.235.206:80/complete/search?client=chrome&hl=en-US&q=www.g](http://74.125.235.206:80/complete/search?client=chrome&hl=en-US&q=www.g)",  
host: “[clients1.google.com](http://clients1.google.com)”  
2012/08/11 10:43:21 [error] 13297#0: \*183 recv() failed (104: Connection  
reset by peer) while reading response header from upstream, client:  
192.168.52.8, server: , request: “GET  
/complete/search?client=chrome&hl=en-US&q=www. HTTP/1.1”, upstream: "  
[http://74.125.235.198:80/complete/search?client=chrome&hl=en-US&q=www.](http://74.125.235.198:80/complete/search?client=chrome&hl=en-US&q=www.)“,  
host: “[clients1.google.com](http://clients1.google.com)”  
2012/08/11 10:43:21 [error] 13297#0: \*191 recv() failed (104: Connection  
reset by peer) while reading response header from upstream, client:  
192.168.52.8, server: , request: “GET  
/complete/search?client=chrome&hl=en-US&q=www. HTTP/1.1”, upstream: "  
[http://74.125.235.196:80/complete/search?client=chrome&hl=en-US&q=www.](http://74.125.235.196:80/complete/search?client=chrome&hl=en-US&q=www.)”,  
host: “[clients1.google.com](http://clients1.google.com)”  
2012/08/11 10:43:21 [error] 13297#0: \*191 recv() failed (104: Connection  
reset by peer) while reading response header from upstream, client:  
192.168.52.8, server: , request: “GET  
/complete/search?client=chrome&hl=en-US&q=www. HTTP/1.1”, upstream: "  
[http://74.125.235.197:80/complete/search?client=chrome&hl=en-US&q=www.](http://74.125.235.197:80/complete/search?client=chrome&hl=en-US&q=www.)",  
host: “[clients1.google.com](http://clients1.google.com)”  
~

---

<div class="post-metadata">

**Author:** ![Geoge.Q](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/e9c0ed/32.png) [@Geoge.Q](https://www.ruby-forum.com/u/Geoge.Q)\
**Post date:** [August 13, 2012, 11:48am UTC](https://www.ruby-forum.com/t/about-resolver-and-502-error/222115/2 "2012-08-13T11:48:16Z")

</div>

On Mon, Aug 13, 2012 at 05:20:40PM +0800, Geoge.Q wrote:

> hi Guys:  
> When I run NGINX as a proxy and set a resolver(such as 8.8.8.8), I found  
> out if DNS fail to resolve, 502 is popped up.  
> We can not set two or more DNS entry, so how to handle suchsituation?

To answer this specific question: upgrade. Recent versions of nginx  
(1.1.7+,  
1.2.x, 1.3.x) support multiple resolvers.

> **[Module ngx\_http\_core\_module](http://nginx.org/en/docs/http/ngx_http_core_module.html#resolver)**
>
> This directive appeared in version 1.11.8.

---

<div class="post-metadata">

**Author:** ![Geoge.Q](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/e9c0ed/32.png) [@Geoge.Q](https://www.ruby-forum.com/u/Geoge.Q)\
**Post date:** [August 13, 2012, 12:17pm UTC](https://www.ruby-forum.com/t/about-resolver-and-502-error/222115/3 "2012-08-13T12:17:31Z")

</div>

It is a great chance for all the pc game fans for that the Guild Wars 2  
is coming on the way! We could freely enjoy the game after it is  
released on August 28. Now, I have found a good place  
to[buy guild wars 2 gold](http://www.gw2goldsale.com),  
the gw2 gold in this store is cheaper than any  
other[gw2 gold](http://www.gw2goldsale.com) store. If  
youwant to buy cheap guild wars 2 gold. I think it is an idea choice! I  
ama old fan for guild wars and I do hopely the guild wars 2 can  
comesoon!

Posted at Nginx Forum:

> **[Re: About resolver and 502 error](https://forum.nginx.org/read.php?2,229627,229632#msg-229632)**
>
> hi Guys: When I run NGINX as a proxy and set a resolver(such as 8.8.8.8), I found out if DNS fail to resolve, 502 is popped up. We can not set two or more DNS entry, so how to handle such situation? post my configuration as following:

---

<div class="post-metadata">

**Author:** ![Geoge.Q](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/e9c0ed/32.png) [@Geoge.Q](https://www.ruby-forum.com/u/Geoge.Q)\
**Post date:** [August 13, 2012, 4:30pm UTC](https://www.ruby-forum.com/t/about-resolver-and-502-error/222115/4 "2012-08-13T16:30:02Z")

</div>

thanks Ruslan, it works now 🙂
