# How to rewrite set-cookie path?

**URL:** <https://community.traefik.io/t/how-to-rewrite-set-cookie-path/6277>\
**Category:** Traefik v2\
**Tags:** middleware\
**Created:** [May 29, 2020, 12:15pm UTC](https://community.traefik.io/t/how-to-rewrite-set-cookie-path/6277 "2020-05-29T12:15:52Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![sparkoo](https://sea2.discourse-cdn.com/flex020/user_avatar/community.traefik.io/sparkoo/32/2700_2.png) [@sparkoo](https://community.traefik.io/u/sparkoo)\
**Post date:** [May 29, 2020, 12:15pm UTC](https://community.traefik.io/t/how-to-rewrite-set-cookie-path/6277/1 "2020-05-29T12:15:52Z")

</div>

Hi,  
Is is possible to set prefix to response header set-cookie path?

I'm trying to do reverse proxy with Traefik, so that path `/server_X/whatever` is routed to server\_X. I need servers not be aware of this, so we strip path prefix, so server see request on `/whatever`. The issue is, when the server set cookies with request path, it's set to `/whatever`, which is not correct as browser is on `/server_X/whatever`, thus does not use this cookie. I can't use `/`, because servers use same cookies, so they would rewrite them all the time under their hands.

I need Traefik to rewrite response header set-cookie path to prefix it with `/server_X`. Is it possible? I'm able to do it with Nginx and HAProxy, but so far unlucky with Traefik. I found this feature request [https://github.com/containous/traefik/issues/6047](https://github.com/containous/traefik/issues/6047) that looks like it could help, but no progress there.

Thanks in advance

---

<div class="post-metadata">

**Author:** ![jmichler](https://sea2.discourse-cdn.com/flex020/user_avatar/community.traefik.io/jmichler/32/2833_2.png) [@jmichler](https://community.traefik.io/u/jmichler)\
**Post date:** [November 11, 2020, 5:32pm UTC](https://community.traefik.io/t/how-to-rewrite-set-cookie-path/6277/2 "2020-11-11T17:32:10Z")

</div>

We have a similar requirement where we'd like to make the cookies SameSite=None . However the "Headers" Plugin seems only to help to replace cookies. Any idea on this? We want to make our backend application able to be served as an iframe without modifying the backend itself.  
Maybe [https://github.com/tomMoulard/htransformation](https://github.com/tomMoulard/htransformation) could help but that seems "early stage of dev"?
