# How to send two set-cookie headers or more

**URL:** <https://community.traefik.io/t/how-to-send-two-set-cookie-headers-or-more/14547>\
**Category:** Traefik v2\
**Tags:** middleware\
**Created:** [May 23, 2022, 3:49am UTC](https://community.traefik.io/t/how-to-send-two-set-cookie-headers-or-more/14547 "2022-05-23T03:49:24Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![zorgzerg](https://sea2.discourse-cdn.com/flex020/user_avatar/community.traefik.io/zorgzerg/32/5371_2.png) [@zorgzerg](https://community.traefik.io/u/zorgzerg)\
**Post date:** [May 23, 2022, 3:49am UTC](https://community.traefik.io/t/how-to-send-two-set-cookie-headers-or-more/14547/1 "2022-05-23T03:49:24Z")

</div>

Can I set two custom headers 'set-cookie' in response, or more?  
I was tried:

```auto
http:
  middlewares:
    cookie1:
      headers:
        customResponseHeaders:
          set-cookie: 'foo=bar;path=/'
    cookie2:
      headers:
        customResponseHeaders:
          set-cookie: 'asd=qwe;path=/'
...

routes:
  my-router:
    middlewares:
      - cookie1
      - cookie2

...

```

But i see only one header `set-cookie: foo=bar;path=/` in response. Only the one declared first in the ingress route

---

<div class="post-metadata">

**Author:** ![moutoum](https://sea2.discourse-cdn.com/flex020/user_avatar/community.traefik.io/moutoum/32/5325_2.png) [@moutoum](https://community.traefik.io/u/moutoum)\
**Post date:** [May 25, 2022, 8:46am UTC](https://community.traefik.io/t/how-to-send-two-set-cookie-headers-or-more/14547/2 "2022-05-25T08:46:43Z")

</div>

Hi @zorgzerg,  
Thanks for your interest in Traefik.

The current behavior of the header middleware is to replace the header value.  
It is not possible to append the values in the cookie in Traefik.

If you need more help, could you describe your use case?

---

<div class="post-metadata">

**Author:** ![zorgzerg](https://sea2.discourse-cdn.com/flex020/user_avatar/community.traefik.io/zorgzerg/32/5371_2.png) [@zorgzerg](https://community.traefik.io/u/zorgzerg)\
**Post date:** [May 26, 2022, 1:40am UTC](https://community.traefik.io/t/how-to-send-two-set-cookie-headers-or-more/14547/3 "2022-05-26T01:40:48Z")

</div>

I want to pass two parameters in a cookie (they will be different for dev and prod environments) when requesting my SPA from the server. So far, I see only one solution: pass JSON in one cookie parameter and parse it in SPA

---

<div class="post-metadata">

**Author:** ![moutoum](https://sea2.discourse-cdn.com/flex020/user_avatar/community.traefik.io/moutoum/32/5325_2.png) [@moutoum](https://community.traefik.io/u/moutoum)\
**Post date:** [May 27, 2022, 7:31am UTC](https://community.traefik.io/t/how-to-send-two-set-cookie-headers-or-more/14547/4 "2022-05-27T07:31:12Z")

</div>

Seems to be a good solution.  
Let me know if you need more help on this.
