# Spdy per location

**URL:** <https://www.ruby-forum.com/t/spdy-per-location/235685>\
**Category:** NGINX\
**Created:** [July 8, 2013, 3:07pm UTC](https://www.ruby-forum.com/t/spdy-per-location/235685 "2013-07-08T15:07:25Z")\
**Posts on this page:** 4\
**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:** [July 8, 2013, 3:07pm UTC](https://www.ruby-forum.com/t/spdy-per-location/235685/1 "2013-07-08T15:07:25Z")

</div>

Hi  
I’m trying to set up spdy so that I can choose weather or not to use it  
based on the server location that’s accessed  
As I understand, the underlying protocol (http/https/spdy) is  
established first before any request can be sent (e.g. before we know  
which location it will match)

I know this example is totally impossible, but would like to know if  
there is a real way of doing it:

server  
{  
listen 80;  
listen 443 ssl spdy;

```
 location /
 {
     spdy off;
     blah;
 }

 location /spdy
 {
     spdy on;
     blah;
 }

```

}

Many thanks

---

<div class="post-metadata">

**Author:** ![rkoskela](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/ce73a5/32.png) [@rkoskela](https://www.ruby-forum.com/u/rkoskela)\
**Post date:** [July 8, 2013, 4:46pm UTC](https://www.ruby-forum.com/t/spdy-per-location/235685/2 "2013-07-08T16:46:11Z")

</div>

spdy is a socket directive option. You cannot set it outside of that  
context AFAICT.

What you can do is play with redirects between two hosts, one with spdy  
and  
one without.

Since usually certs have at least one DNS name besides the CN you can do  
it  
with the same cert. Probably  
I haven’t tested and don’t know if Nginx complains about a duplicated  
cert  
in different hosts.

It’s not nice or clean. It’s an ugly hack.

----appa

On Mon, Jul 8, 2013 at 3:06 PM, Richard K.  
\<removed\_email\_address@domain.invalid

---

<div class="post-metadata">

**Author:** ![rkoskela](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/ce73a5/32.png) [@rkoskela](https://www.ruby-forum.com/u/rkoskela)\
**Post date:** [July 8, 2013, 4:50pm UTC](https://www.ruby-forum.com/t/spdy-per-location/235685/3 "2013-07-08T16:50:16Z")

</div>

Hello.

It works like this:

1. accept tcp connection
2. establish ssl session  
a) presenting first certificate  
b) optional: present 2nd certificate for desired virtual host via SNI  
extension
3. NPN (next protocol negotiation), enabling SPDY

---

<div class="post-metadata">

**Author:** ![rkoskela](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/ce73a5/32.png) [@rkoskela](https://www.ruby-forum.com/u/rkoskela)\
**Post date:** [July 8, 2013, 6:40pm UTC](https://www.ruby-forum.com/t/spdy-per-location/235685/4 "2013-07-08T18:40:42Z")

</div>

* * *

nginx mailing list  
removed\_email\_address@domain.invalid  
[http://mailman.nginx.org/mailman/listinfo/nginx](http://mailman.nginx.org/mailman/listinfo/nginx)
