# Proxy: cookie injection or header filter

**URL:** <https://www.ruby-forum.com/t/proxy-cookie-injection-or-header-filter/198169>\
**Category:** NGINX\
**Created:** [October 27, 2010, 3:04pm UTC](https://www.ruby-forum.com/t/proxy-cookie-injection-or-header-filter/198169 "2010-10-27T15:04:44Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![okkezSS](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/o/85f322/32.png) [@okkezSS](https://www.ruby-forum.com/u/okkezSS)\
**Post date:** [October 27, 2010, 3:04pm UTC](https://www.ruby-forum.com/t/proxy-cookie-injection-or-header-filter/198169/1 "2010-10-27T15:04:44Z")

</div>

My nginx proxy configuration:

```
    location / {
        proxy_pass http://site.external.com/;
        proxy_redirect http://site.external.com 

```

[http://site.local.my](http://site.local.my);  
proxy\_set\_header Accept-Encoding “”;  
sub\_filter [http://site.external.com](http://site.external.com) [https://site.local.my](https://site.local.my);  
sub\_filter\_types text/xml text/css text/javascript;  
sub\_filter\_once off;  
}  
Every thing would be great but [site.external.com](http://site.external.com) sets cookie with  
domain .external.com and browser doesn’t accept it. So i would like to  
filter the header of the response, or inject a cookie (add\_header  
Set-Cookie "JSESSIONID=…) based on existing Set-Cookie http  
response.

Can any one suggest a configuration, module, link … whatever ?

Best regards.

–  
Andrzej Zadrożny  
e-mail: removed\_email\_address@domain.invalid
