# What exactly does proxy\_http\_version mean?

**URL:** <https://www.ruby-forum.com/t/what-exactly-does-proxy-http-version-mean/221167>\
**Category:** NGINX\
**Created:** [July 3, 2012, 10:22am UTC](https://www.ruby-forum.com/t/what-exactly-does-proxy-http-version-mean/221167 "2012-07-03T10:22:42Z")\
**Posts on this page:** 5\
**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:** [July 3, 2012, 10:22am UTC](https://www.ruby-forum.com/t/what-exactly-does-proxy-http-version-mean/221167/1 "2012-07-03T10:22:42Z")

</div>

Along with nginx-1.1.4, a new directive named ‘proxy\_http\_version’  
introduced  
I thought it was something related to the communication between nginx  
cache and upstream web server, right?

But per my tests with latest v-1.2.1, Nginx is still using HTTP/1.0 to  
access upstream web server.

+++++++++  
abc $ curl -I -H ‘If-None-Match: “9cx7b1-x2e-44xa4x9axd0x0”’  
[http://test.stg/crossdomain.xml](http://test.stg/crossdomain.xml)  
HTTP/1.1 200 OK  
Server: nginx/1.2.1  
…  
+++++++++ end

Which intends to return 3.4 if it’s using HTTP/1.1, did I misunderstand  
this directive?

Thanks for any input…

Posted at Nginx Forum:

> **[what exactly does proxy\_http\_version mean?](https://forum.nginx.org/read.php?2,228225,228225#msg-228225)**
>
> Along with nginx-1.1.4, a new directive named 'proxy\_http\_version' introduced I thought it was something related to the communication between nginx cache and upstream web server, right? But per my tests with latest v-1.2.1, Nginx is still using...

---

<div class="post-metadata">

**Author:** ![admon.org](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/d26b3c/32.png) [@admon.org](https://www.ruby-forum.com/u/admon.org)\
**Post date:** [July 3, 2012, 11:45am UTC](https://www.ruby-forum.com/t/what-exactly-does-proxy-http-version-mean/221167/2 "2012-07-03T11:45:06Z")

</div>

On Tue, Jul 03, 2012 at 04:22:14AM -0400, [admon.org](http://admon.org) wrote:

Hi there,

> Along with nginx-1.1.4, a new directive named ‘proxy\_http\_version’  
> introduced  
> I thought it was something related to the communication between nginx  
> cache and upstream web server, right?

That’s what [Module ngx\_http\_proxy\_module](http://nginx.org/r/proxy_http_version) says, yes. (Although  
I probably wouldn’t call it “nginx cache”.)

> But per my tests with latest v-1.2.1, Nginx is still using HTTP/1.0 to  
> access upstream web server.

How can I repeat your tests? Your results don’t match mine.

> Thanks for any input..

cgi script “ex”, available on a local http server:

# == #!/bin/sh echo Content-Type: text/plain echo echo SERVER\_PROTOCOL=$SERVER\_PROTOCOL

relevant part of nginx.conf:

==  
server {  
listen 8080;

# proxy\_http\_version 1.1;

# location / { proxy\_pass [http://127.0.0.1:10080/ex/](http://127.0.0.1:10080/ex/); } }

$ curl [http://localhost:8080/](http://localhost:8080/)  
SERVER\_PROTOCOL=HTTP/1.0

Uncomment the nginx.conf line and reload

$ curl [http://localhost:8080/](http://localhost:8080/)  
SERVER\_PROTOCOL=HTTP/1.1

$ sbin/nginx -v  
nginx version: nginx/1.2.1

## f

Francis D. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)

---

<div class="post-metadata">

**Author:** ![admon.org](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/d26b3c/32.png) [@admon.org](https://www.ruby-forum.com/u/admon.org)\
**Post date:** [July 3, 2012, 7:13pm UTC](https://www.ruby-forum.com/t/what-exactly-does-proxy-http-version-mean/221167/3 "2012-07-03T19:13:23Z")

</div>

Hello!

On Tue, Jul 03, 2012 at 09:58:12AM -0400, [admon.org](http://admon.org) wrote:

> Many thanks Francis!  
> Here are my configs, I’m using Nginx as a reverse proxy server to cache  
> static files from its upstream servers.

[…]

> the upstream server.
> 
> Can you help have another check. Appriciated!

With cache switched on nginx strips all conditional headers in  
requests to backends to make sure it’ll get full response which  
may be cached. And as nginx itself doesn’t support entity tags  
yet, the request with If-None-Match doesn’t return 304.

Support for entity tags are expected to appear soon, somewhere  
near upcoming 1.3.3.

Maxim D.

---

<div class="post-metadata">

**Author:** ![admon.org](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/d26b3c/32.png) [@admon.org](https://www.ruby-forum.com/u/admon.org)\
**Post date:** [July 3, 2012, 3:58pm UTC](https://www.ruby-forum.com/t/what-exactly-does-proxy-http-version-mean/221167/4 "2012-07-03T15:58:48Z")

</div>

Many thanks Francis!  
Here are my configs, I’m using Nginx as a reverse proxy server to cache  
static files from its upstream servers.

+++++++++++++++++++++++++++++++++++  
proxy\_temp\_path /tmp/proxy\_temp\_dir;  
proxy\_cache\_path /tmp/proxy\_cache\_dir levels=1:2  
keys\_zone=cache\_one:200m inactive=1d max\_size=30g;

```
upstream backend_server {
    server myserver01 weight=1 max_fails=2 fail_timeout=15s;
    server myserver02 weight=1 max_fails=2 fail_timeout=15s;
}

server {
    listen 80;
    server_name test.stg
    root html;
    index index.html index.htm;

    charset utf-8;

    location / {
        proxy_next_upstream http_502 http_504 error timeout

```

invalid\_header;  
proxy\_cache cache\_one;  
proxy\_cache\_valid 200 304 12h;  
proxy\_cache\_key $host$uri$is\_args$args;  
proxy\_set\_header Host $host;  
proxy\_set\_header X-Forwarded-For $remote\_addr;  
proxy\_set\_header Connection “”;

```
        proxy_pass http://backend_server;
        proxy_http_version 1.1;
        expires 1d;
    }

    #error_page 404 /404.html;
    # redirect server error pages to the static page /50x.html
    error_page 500 502 503 504 /50x.html;
    location = /50x.html {
         root html;
    }

```

+++++++++++++++++++++++++++++++++++ END

I’m trying to implement a smart way to purge cache e.g. by touching the  
file to change its etag. This needs the HTTP/1.1 support. But per my  
tests, Nginx does not return expected value.

$ curl -I -H ‘If-None-Match: “9cx7b1-x2e-44xa4x9axd0x0”’  
[http://test.stg/crossdomain.xml](http://test.stg/crossdomain.xml)

This command gives 200 OK return code, but if I use Varnish instead, it  
gives the expected value 304 Not Modified.  
So I’m wondering that it may be caused by the protocal between Nginx and  
the upstream server.

Can you help have another check. Appriciated!

Posted at Nginx Forum:

> **[Re: what exactly does proxy\_http\_version mean?](https://forum.nginx.org/read.php?2,228225,228245#msg-228245)**
>
> Along with nginx-1.1.4, a new directive named 'proxy\_http\_version' introduced I thought it was something related to the communication between nginx cache and upstream web server, right? But per my tests with latest v-1.2.1, Nginx is still using...

---

<div class="post-metadata">

**Author:** ![admon.org](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/d26b3c/32.png) [@admon.org](https://www.ruby-forum.com/u/admon.org)\
**Post date:** [July 4, 2012, 5:17am UTC](https://www.ruby-forum.com/t/what-exactly-does-proxy-http-version-mean/221167/5 "2012-07-04T05:17:47Z")

</div>

Maxim, That’s Cool, Thanks a lot for your updates!

Posted at Nginx Forum:

> **[Re: what exactly does proxy\_http\_version mean?](https://forum.nginx.org/read.php?2,228225,228262#msg-228262)**
>
> Along with nginx-1.1.4, a new directive named 'proxy\_http\_version' introduced I thought it was something related to the communication between nginx cache and upstream web server, right? But per my tests with latest v-1.2.1, Nginx is still using...
