Replacing http-request / response cookie domain dynamically in HAProxyHAProxy: Possible to dynamically...

Why did Kant, Hegel, and Adorno leave some words and phrases in the Greek alphabet?

How can I use the arrow sign in my bash prompt?

How to verify if g is a generator for p?

I'm in charge of equipment buying but no one's ever happy with what I choose. How to fix this?

Ways to speed up user implemented RK4

Is a roofing delivery truck likely to crack my driveway slab?

Can somebody explain Brexit in a few child-proof sentences?

Star/Wye electrical connection math symbol

How could Frankenstein get the parts for his _second_ creature?

Coordinate position not precise

How to prove that the query oracle is unitary?

Using parameter substitution on a Bash array

Personal Teleportation as a Weapon

Will it be accepted, if there is no ''Main Character" stereotype?

How can a jailer prevent the Forge Cleric's Artisan's Blessing from being used?

Time travel short story where a man arrives in the late 19th century in a time machine and then sends the machine back into the past

Why are on-board computers allowed to change controls without notifying the pilots?

What is difference between behavior and behaviour

Where in the Bible does the greeting ("Dominus Vobiscum") used at Mass come from?

How to be diplomatic in refusing to write code that breaches the privacy of our users

How can I get through very long and very dry, but also very useful technical documents when learning a new tool?

Modify casing of marked letters

How does it work when somebody invests in my business?

Go Pregnant or Go Home



Replacing http-request / response cookie domain dynamically in HAProxy


HAProxy: Possible to dynamically construct new headers based on the HTTP request?HAProxy appsession vs cookie precedenceHAProxy HTTP vs TCPHA-Proxy 301 re-direct: https to https://wwwHAProxy HTTP Response “Other”Create persistent cookie in HAProxyHaproxy http-buffer-request not workingHaproxy http response timeout checkHTTP request duration with HAProxyhaproxy http request <NOSRV> reponse













0















I have legacy 3rd party software that can only respond to 1 domain. It responds back with cookies set with the configured domain.



I have this configuration below currently working on haproxy, where I can send traffic to xyz.com, and it forwards the request to my backend that's configured to abc.com.



It then replaces the cookie domains, so that the backend software works correctly.



backend cluster_abc
balance leastconn
option forwardfor
http-send-name-header Host
http-request replace-value Cookie (.*)domain=.xyz.com$ domain=.abc.com
http-response replace-value Set-Cookie (.*)domain=.abc.com$ domain=.xyz.com
server www.abc.com backendstuff.com:80 resolvers dns check inter 1000


I need to add more domains. Is it possible to do something like this?



http-response replace-value Set-Cookie (.*)domain=.abc.com$ domain=.{{REQUESTED_DOMAIN}}.com


So I don't have to hardcode the domains?









share



























    0















    I have legacy 3rd party software that can only respond to 1 domain. It responds back with cookies set with the configured domain.



    I have this configuration below currently working on haproxy, where I can send traffic to xyz.com, and it forwards the request to my backend that's configured to abc.com.



    It then replaces the cookie domains, so that the backend software works correctly.



    backend cluster_abc
    balance leastconn
    option forwardfor
    http-send-name-header Host
    http-request replace-value Cookie (.*)domain=.xyz.com$ domain=.abc.com
    http-response replace-value Set-Cookie (.*)domain=.abc.com$ domain=.xyz.com
    server www.abc.com backendstuff.com:80 resolvers dns check inter 1000


    I need to add more domains. Is it possible to do something like this?



    http-response replace-value Set-Cookie (.*)domain=.abc.com$ domain=.{{REQUESTED_DOMAIN}}.com


    So I don't have to hardcode the domains?









    share

























      0












      0








      0








      I have legacy 3rd party software that can only respond to 1 domain. It responds back with cookies set with the configured domain.



      I have this configuration below currently working on haproxy, where I can send traffic to xyz.com, and it forwards the request to my backend that's configured to abc.com.



      It then replaces the cookie domains, so that the backend software works correctly.



      backend cluster_abc
      balance leastconn
      option forwardfor
      http-send-name-header Host
      http-request replace-value Cookie (.*)domain=.xyz.com$ domain=.abc.com
      http-response replace-value Set-Cookie (.*)domain=.abc.com$ domain=.xyz.com
      server www.abc.com backendstuff.com:80 resolvers dns check inter 1000


      I need to add more domains. Is it possible to do something like this?



      http-response replace-value Set-Cookie (.*)domain=.abc.com$ domain=.{{REQUESTED_DOMAIN}}.com


      So I don't have to hardcode the domains?









      share














      I have legacy 3rd party software that can only respond to 1 domain. It responds back with cookies set with the configured domain.



      I have this configuration below currently working on haproxy, where I can send traffic to xyz.com, and it forwards the request to my backend that's configured to abc.com.



      It then replaces the cookie domains, so that the backend software works correctly.



      backend cluster_abc
      balance leastconn
      option forwardfor
      http-send-name-header Host
      http-request replace-value Cookie (.*)domain=.xyz.com$ domain=.abc.com
      http-response replace-value Set-Cookie (.*)domain=.abc.com$ domain=.xyz.com
      server www.abc.com backendstuff.com:80 resolvers dns check inter 1000


      I need to add more domains. Is it possible to do something like this?



      http-response replace-value Set-Cookie (.*)domain=.abc.com$ domain=.{{REQUESTED_DOMAIN}}.com


      So I don't have to hardcode the domains?







      haproxy





      share












      share










      share



      share










      asked 9 mins ago









      Andrew WeiAndrew Wei

      14519




      14519






















          0






          active

          oldest

          votes











          Your Answer








          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "2"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });














          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fserverfault.com%2fquestions%2f960153%2freplacing-http-request-response-cookie-domain-dynamically-in-haproxy%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          0






          active

          oldest

          votes








          0






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes
















          draft saved

          draft discarded




















































          Thanks for contributing an answer to Server Fault!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fserverfault.com%2fquestions%2f960153%2freplacing-http-request-response-cookie-domain-dynamically-in-haproxy%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          117736 Шеррод Примітки | Див. також | Посилання | Навігаційне...

          As a Security Precaution, the user account has been locked The Next CEO of Stack OverflowMS...

          Маріан Котлеба Зміст Життєпис | Політичні погляди |...