Apigee Proxy passing same host header to target











up vote
1
down vote

favorite












I have a simple apigee proxy, but I can see in the trace an issue where the Host header going to the target contains the host of the proxy itself.



i.e. the target gets



Host: xx.apigeename.com



rather than:



Host: my.awsservername.com



The target is on a different domain to the proxy, so it means that the target server is improperly handling the request (404 in this case).



Why is it that Apigee might be sending the exact same host header and not transforming it?



I have tried to explicitly set it, by setting the TargetEndpoint:



<TargetEndpoint name="xyzzy">
<Description/>
<FaultRules/>
<PreFlow name="PreFlow">
<Request>
<Headers>
<Header name="Host">{target.host}</Header>
</Headers>
</Request>
<Response>
</Response>
</PreFlow>
<PostFlow name="PostFlow">
<Request/>
<Response/>
</PostFlow>
<Flows/>
<HTTPTargetConnection>
<Properties/>
<URL>https://{targetBackend}/xyzzy</URL>
<SSLInfo>
<Enabled>true</Enabled>
<Protocols>
<Protocol>TLSv1.2</Protocol>
</Protocols>
</SSLInfo>
</HTTPTargetConnection>
</TargetEndpoint>


The documentation Apigee has on this seems very vague.



It's getting super frustrating. We have other proxies that are working fine without doing anything special.










share|improve this question


























    up vote
    1
    down vote

    favorite












    I have a simple apigee proxy, but I can see in the trace an issue where the Host header going to the target contains the host of the proxy itself.



    i.e. the target gets



    Host: xx.apigeename.com



    rather than:



    Host: my.awsservername.com



    The target is on a different domain to the proxy, so it means that the target server is improperly handling the request (404 in this case).



    Why is it that Apigee might be sending the exact same host header and not transforming it?



    I have tried to explicitly set it, by setting the TargetEndpoint:



    <TargetEndpoint name="xyzzy">
    <Description/>
    <FaultRules/>
    <PreFlow name="PreFlow">
    <Request>
    <Headers>
    <Header name="Host">{target.host}</Header>
    </Headers>
    </Request>
    <Response>
    </Response>
    </PreFlow>
    <PostFlow name="PostFlow">
    <Request/>
    <Response/>
    </PostFlow>
    <Flows/>
    <HTTPTargetConnection>
    <Properties/>
    <URL>https://{targetBackend}/xyzzy</URL>
    <SSLInfo>
    <Enabled>true</Enabled>
    <Protocols>
    <Protocol>TLSv1.2</Protocol>
    </Protocols>
    </SSLInfo>
    </HTTPTargetConnection>
    </TargetEndpoint>


    The documentation Apigee has on this seems very vague.



    It's getting super frustrating. We have other proxies that are working fine without doing anything special.










    share|improve this question
























      up vote
      1
      down vote

      favorite









      up vote
      1
      down vote

      favorite











      I have a simple apigee proxy, but I can see in the trace an issue where the Host header going to the target contains the host of the proxy itself.



      i.e. the target gets



      Host: xx.apigeename.com



      rather than:



      Host: my.awsservername.com



      The target is on a different domain to the proxy, so it means that the target server is improperly handling the request (404 in this case).



      Why is it that Apigee might be sending the exact same host header and not transforming it?



      I have tried to explicitly set it, by setting the TargetEndpoint:



      <TargetEndpoint name="xyzzy">
      <Description/>
      <FaultRules/>
      <PreFlow name="PreFlow">
      <Request>
      <Headers>
      <Header name="Host">{target.host}</Header>
      </Headers>
      </Request>
      <Response>
      </Response>
      </PreFlow>
      <PostFlow name="PostFlow">
      <Request/>
      <Response/>
      </PostFlow>
      <Flows/>
      <HTTPTargetConnection>
      <Properties/>
      <URL>https://{targetBackend}/xyzzy</URL>
      <SSLInfo>
      <Enabled>true</Enabled>
      <Protocols>
      <Protocol>TLSv1.2</Protocol>
      </Protocols>
      </SSLInfo>
      </HTTPTargetConnection>
      </TargetEndpoint>


      The documentation Apigee has on this seems very vague.



      It's getting super frustrating. We have other proxies that are working fine without doing anything special.










      share|improve this question













      I have a simple apigee proxy, but I can see in the trace an issue where the Host header going to the target contains the host of the proxy itself.



      i.e. the target gets



      Host: xx.apigeename.com



      rather than:



      Host: my.awsservername.com



      The target is on a different domain to the proxy, so it means that the target server is improperly handling the request (404 in this case).



      Why is it that Apigee might be sending the exact same host header and not transforming it?



      I have tried to explicitly set it, by setting the TargetEndpoint:



      <TargetEndpoint name="xyzzy">
      <Description/>
      <FaultRules/>
      <PreFlow name="PreFlow">
      <Request>
      <Headers>
      <Header name="Host">{target.host}</Header>
      </Headers>
      </Request>
      <Response>
      </Response>
      </PreFlow>
      <PostFlow name="PostFlow">
      <Request/>
      <Response/>
      </PostFlow>
      <Flows/>
      <HTTPTargetConnection>
      <Properties/>
      <URL>https://{targetBackend}/xyzzy</URL>
      <SSLInfo>
      <Enabled>true</Enabled>
      <Protocols>
      <Protocol>TLSv1.2</Protocol>
      </Protocols>
      </SSLInfo>
      </HTTPTargetConnection>
      </TargetEndpoint>


      The documentation Apigee has on this seems very vague.



      It's getting super frustrating. We have other proxies that are working fine without doing anything special.







      apigee apigee-baas






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Oct 29 at 11:44









      Paul Deen

      2891214




      2891214
























          1 Answer
          1






          active

          oldest

          votes

















          up vote
          0
          down vote













          This seems odd. Apigee should not do that by default. Are you sure that other flows are setup correctly? Anyhow.. you can try to create a AssignMessage policy that adds the correct host.
          Take a look at this: https://docs.apigee.com/api-platform/reference/policies/assign-message-policy#Samples



          ./policies/hostPolicy.xml:



          <AssignMessage name="hostPolicy" continueOnError="false">
          <AssignTo createNew="false" type="request"></AssignTo>
          <Set>
          <Headers>
          <Header name="Host">{target.host}</Header>
          </Headers>
          </Set>
          </AssignMessage>


          ./targets/xyzzy.xml



            <PreFlow name="PreFlow">
          <Request>
          <Step>
          <Name>hostPolicy</Name>
          </Step>
          </Request>
          </PreFlow>


          NB: I haven't tested this. Read the vague apigee docs on policies






          share|improve this answer





















            Your Answer






            StackExchange.ifUsing("editor", function () {
            StackExchange.using("externalEditor", function () {
            StackExchange.using("snippets", function () {
            StackExchange.snippets.init();
            });
            });
            }, "code-snippets");

            StackExchange.ready(function() {
            var channelOptions = {
            tags: "".split(" "),
            id: "1"
            };
            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',
            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%2fstackoverflow.com%2fquestions%2f53044823%2fapigee-proxy-passing-same-host-header-to-target%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown

























            1 Answer
            1






            active

            oldest

            votes








            1 Answer
            1






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes








            up vote
            0
            down vote













            This seems odd. Apigee should not do that by default. Are you sure that other flows are setup correctly? Anyhow.. you can try to create a AssignMessage policy that adds the correct host.
            Take a look at this: https://docs.apigee.com/api-platform/reference/policies/assign-message-policy#Samples



            ./policies/hostPolicy.xml:



            <AssignMessage name="hostPolicy" continueOnError="false">
            <AssignTo createNew="false" type="request"></AssignTo>
            <Set>
            <Headers>
            <Header name="Host">{target.host}</Header>
            </Headers>
            </Set>
            </AssignMessage>


            ./targets/xyzzy.xml



              <PreFlow name="PreFlow">
            <Request>
            <Step>
            <Name>hostPolicy</Name>
            </Step>
            </Request>
            </PreFlow>


            NB: I haven't tested this. Read the vague apigee docs on policies






            share|improve this answer

























              up vote
              0
              down vote













              This seems odd. Apigee should not do that by default. Are you sure that other flows are setup correctly? Anyhow.. you can try to create a AssignMessage policy that adds the correct host.
              Take a look at this: https://docs.apigee.com/api-platform/reference/policies/assign-message-policy#Samples



              ./policies/hostPolicy.xml:



              <AssignMessage name="hostPolicy" continueOnError="false">
              <AssignTo createNew="false" type="request"></AssignTo>
              <Set>
              <Headers>
              <Header name="Host">{target.host}</Header>
              </Headers>
              </Set>
              </AssignMessage>


              ./targets/xyzzy.xml



                <PreFlow name="PreFlow">
              <Request>
              <Step>
              <Name>hostPolicy</Name>
              </Step>
              </Request>
              </PreFlow>


              NB: I haven't tested this. Read the vague apigee docs on policies






              share|improve this answer























                up vote
                0
                down vote










                up vote
                0
                down vote









                This seems odd. Apigee should not do that by default. Are you sure that other flows are setup correctly? Anyhow.. you can try to create a AssignMessage policy that adds the correct host.
                Take a look at this: https://docs.apigee.com/api-platform/reference/policies/assign-message-policy#Samples



                ./policies/hostPolicy.xml:



                <AssignMessage name="hostPolicy" continueOnError="false">
                <AssignTo createNew="false" type="request"></AssignTo>
                <Set>
                <Headers>
                <Header name="Host">{target.host}</Header>
                </Headers>
                </Set>
                </AssignMessage>


                ./targets/xyzzy.xml



                  <PreFlow name="PreFlow">
                <Request>
                <Step>
                <Name>hostPolicy</Name>
                </Step>
                </Request>
                </PreFlow>


                NB: I haven't tested this. Read the vague apigee docs on policies






                share|improve this answer












                This seems odd. Apigee should not do that by default. Are you sure that other flows are setup correctly? Anyhow.. you can try to create a AssignMessage policy that adds the correct host.
                Take a look at this: https://docs.apigee.com/api-platform/reference/policies/assign-message-policy#Samples



                ./policies/hostPolicy.xml:



                <AssignMessage name="hostPolicy" continueOnError="false">
                <AssignTo createNew="false" type="request"></AssignTo>
                <Set>
                <Headers>
                <Header name="Host">{target.host}</Header>
                </Headers>
                </Set>
                </AssignMessage>


                ./targets/xyzzy.xml



                  <PreFlow name="PreFlow">
                <Request>
                <Step>
                <Name>hostPolicy</Name>
                </Step>
                </Request>
                </PreFlow>


                NB: I haven't tested this. Read the vague apigee docs on policies







                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered yesterday









                Mr.Turtle

                8632924




                8632924






























                     

                    draft saved


                    draft discarded



















































                     


                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function () {
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53044823%2fapigee-proxy-passing-same-host-header-to-target%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

                    Saint-Aignan (Tarn-et-Garonne)

                    Volksrepublik China

                    How to test boost logger output in unit testing?