Apache UseCanonicalName On isnt passing ServerName to CGI The 2019 Stack Overflow Developer Survey Results Are InApache2 - mod_expire and mod_rewrite not working in httpd.conf - serving content from tomcat(13) Permission denied on Apache CGI attemptgzip compression using mod_deflate apache with tomcatRequire ServerName in VirtualHostApache ever match a virtual host with a different ServerNameForbidden Access. CGI -apachePassing Apache variable into SetHandler directiveissue with Apache and CGI scriptApache ServerName being ignoredApache CGI-Bin Hot Update

How to make payment on the internet without leaving a money trail?

Is domain driven design an anti-SQL pattern?

What could be the right powersource for 15 seconds lifespan disposable giant chainsaw?

Why is my p-value correlated to difference between means in two sample tests?

What tool would a Roman-age civilization have to grind silver and other metals into dust?

How can I create a character who can assume the widest possible range of creature sizes?

What are the motivations for publishing new editions of an existing textbook, beyond new discoveries in a field?

What is this 4-propeller plane?

What does Linus Torvalds mean when he says that Git "never ever" tracks a file?

It's possible to achieve negative score?

If the Wish spell is used to duplicate the effect of Simulacrum, are existing duplicates destroyed?

Is it possible for the two major parties in the UK to form a coalition with each other instead of a much smaller party?

JSON.serialize: is it possible to suppress null values of a map?

Dual Citizen. Exited the US on Italian passport recently

Limit the amount of RAM Mathematica may access?

What do the Banks children have against barley water?

What is the meaning of Triage in Cybersec world?

Output the Arecibo Message

Understanding the implication of what "well-defined" means for the operation in quotient group

Could JWST stay at L2 "forever"?

What is the motivation for a law requiring 2 parties to consent for recording a conversation

Patience, young "Padovan"

How are circuits which use complex ICs normally simulated?

How to deal with fear of taking dependencies



Apache UseCanonicalName On isnt passing ServerName to CGI



The 2019 Stack Overflow Developer Survey Results Are InApache2 - mod_expire and mod_rewrite not working in httpd.conf - serving content from tomcat(13) Permission denied on Apache CGI attemptgzip compression using mod_deflate apache with tomcatRequire ServerName in VirtualHostApache ever match a virtual host with a different ServerNameForbidden Access. CGI -apachePassing Apache variable into SetHandler directiveissue with Apache and CGI scriptApache ServerName being ignoredApache CGI-Bin Hot Update



.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;








2















On Apache 2.4 in in a virtualhost I have:



UseCanonicalName On
ServerName somename
ServerAlias www.someothername.com


According to the docs:




With UseCanonicalName On Apache will use the hostname and port
specified in the ServerName directive to construct the canonical name
for the server. This name is used in all self-referential URLs, and
for the values of SERVER_NAME and SERVER_PORT in CGIs.




So in my Tomcat/CFML application when I visit the URL www.someothername.com I would expect to see in the CGI scope:



server_name: somename


but instead I get:



server_name: www.someothername.com


It's like the directive is totally ignored.



# Proxy CFML files to Tomcat
RewriteCond %REQUEST_FILENAME /[^/:]+.cfml*($|/)
RewriteRule (.*) ajp://%HTTP_HOST:8009$1 [P,L]


I also tried:



RewriteRule (.*) ajp://%SERVER_NAME:8009$1 [P,L]


and using mod_proxy instead of AJP:



RewriteRule (.*) http://%SERVER_NAME:8888$1 [P,L]


The last 2 cause a DNS lookup on somename but still returns www.someothername.com in the CGI.SERVER_NAME field



I should point out that the only reason I'm doing this is because I'm doing mass virtual-hosting with mod_cfml to automaticatically create tomcat contexts and I would like the context and application to use a short name derived from the vhost configuration. I guess I could just set a header (even rewrite the Host: header) but using ServerName seemed the most elegant solution.



UPDATE: There is something I noticed in the client headers that is probably relevant. There are 2 headers I haven't seen before:



x-forwarded-host: www.someothername.com
x-forwarded-server: somename


I need to know what set these headers and why. I'm assuming it was either Tomcat or mod_cfml. Can I rely on the x-forwarded-server value to always be ServerName?










share|improve this question






























    2















    On Apache 2.4 in in a virtualhost I have:



    UseCanonicalName On
    ServerName somename
    ServerAlias www.someothername.com


    According to the docs:




    With UseCanonicalName On Apache will use the hostname and port
    specified in the ServerName directive to construct the canonical name
    for the server. This name is used in all self-referential URLs, and
    for the values of SERVER_NAME and SERVER_PORT in CGIs.




    So in my Tomcat/CFML application when I visit the URL www.someothername.com I would expect to see in the CGI scope:



    server_name: somename


    but instead I get:



    server_name: www.someothername.com


    It's like the directive is totally ignored.



    # Proxy CFML files to Tomcat
    RewriteCond %REQUEST_FILENAME /[^/:]+.cfml*($|/)
    RewriteRule (.*) ajp://%HTTP_HOST:8009$1 [P,L]


    I also tried:



    RewriteRule (.*) ajp://%SERVER_NAME:8009$1 [P,L]


    and using mod_proxy instead of AJP:



    RewriteRule (.*) http://%SERVER_NAME:8888$1 [P,L]


    The last 2 cause a DNS lookup on somename but still returns www.someothername.com in the CGI.SERVER_NAME field



    I should point out that the only reason I'm doing this is because I'm doing mass virtual-hosting with mod_cfml to automaticatically create tomcat contexts and I would like the context and application to use a short name derived from the vhost configuration. I guess I could just set a header (even rewrite the Host: header) but using ServerName seemed the most elegant solution.



    UPDATE: There is something I noticed in the client headers that is probably relevant. There are 2 headers I haven't seen before:



    x-forwarded-host: www.someothername.com
    x-forwarded-server: somename


    I need to know what set these headers and why. I'm assuming it was either Tomcat or mod_cfml. Can I rely on the x-forwarded-server value to always be ServerName?










    share|improve this question


























      2












      2








      2








      On Apache 2.4 in in a virtualhost I have:



      UseCanonicalName On
      ServerName somename
      ServerAlias www.someothername.com


      According to the docs:




      With UseCanonicalName On Apache will use the hostname and port
      specified in the ServerName directive to construct the canonical name
      for the server. This name is used in all self-referential URLs, and
      for the values of SERVER_NAME and SERVER_PORT in CGIs.




      So in my Tomcat/CFML application when I visit the URL www.someothername.com I would expect to see in the CGI scope:



      server_name: somename


      but instead I get:



      server_name: www.someothername.com


      It's like the directive is totally ignored.



      # Proxy CFML files to Tomcat
      RewriteCond %REQUEST_FILENAME /[^/:]+.cfml*($|/)
      RewriteRule (.*) ajp://%HTTP_HOST:8009$1 [P,L]


      I also tried:



      RewriteRule (.*) ajp://%SERVER_NAME:8009$1 [P,L]


      and using mod_proxy instead of AJP:



      RewriteRule (.*) http://%SERVER_NAME:8888$1 [P,L]


      The last 2 cause a DNS lookup on somename but still returns www.someothername.com in the CGI.SERVER_NAME field



      I should point out that the only reason I'm doing this is because I'm doing mass virtual-hosting with mod_cfml to automaticatically create tomcat contexts and I would like the context and application to use a short name derived from the vhost configuration. I guess I could just set a header (even rewrite the Host: header) but using ServerName seemed the most elegant solution.



      UPDATE: There is something I noticed in the client headers that is probably relevant. There are 2 headers I haven't seen before:



      x-forwarded-host: www.someothername.com
      x-forwarded-server: somename


      I need to know what set these headers and why. I'm assuming it was either Tomcat or mod_cfml. Can I rely on the x-forwarded-server value to always be ServerName?










      share|improve this question
















      On Apache 2.4 in in a virtualhost I have:



      UseCanonicalName On
      ServerName somename
      ServerAlias www.someothername.com


      According to the docs:




      With UseCanonicalName On Apache will use the hostname and port
      specified in the ServerName directive to construct the canonical name
      for the server. This name is used in all self-referential URLs, and
      for the values of SERVER_NAME and SERVER_PORT in CGIs.




      So in my Tomcat/CFML application when I visit the URL www.someothername.com I would expect to see in the CGI scope:



      server_name: somename


      but instead I get:



      server_name: www.someothername.com


      It's like the directive is totally ignored.



      # Proxy CFML files to Tomcat
      RewriteCond %REQUEST_FILENAME /[^/:]+.cfml*($|/)
      RewriteRule (.*) ajp://%HTTP_HOST:8009$1 [P,L]


      I also tried:



      RewriteRule (.*) ajp://%SERVER_NAME:8009$1 [P,L]


      and using mod_proxy instead of AJP:



      RewriteRule (.*) http://%SERVER_NAME:8888$1 [P,L]


      The last 2 cause a DNS lookup on somename but still returns www.someothername.com in the CGI.SERVER_NAME field



      I should point out that the only reason I'm doing this is because I'm doing mass virtual-hosting with mod_cfml to automaticatically create tomcat contexts and I would like the context and application to use a short name derived from the vhost configuration. I guess I could just set a header (even rewrite the Host: header) but using ServerName seemed the most elegant solution.



      UPDATE: There is something I noticed in the client headers that is probably relevant. There are 2 headers I haven't seen before:



      x-forwarded-host: www.someothername.com
      x-forwarded-server: somename


      I need to know what set these headers and why. I'm assuming it was either Tomcat or mod_cfml. Can I rely on the x-forwarded-server value to always be ServerName?







      tomcat apache-2.4






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Feb 3 '14 at 4:16







      SpliFF

















      asked Feb 3 '14 at 3:16









      SpliFFSpliFF

      2492622




      2492622




















          1 Answer
          1






          active

          oldest

          votes


















          0














          You're not calling a CGI, you're proxying, so trying to set SERVER_NAME is either useless or very close to it.



          Typically with mass virtual hosting you should use the actual domain name that you received, which is HTTP_HOST, the Host: HTTP header, in your application to make the distinction.






          share|improve this answer























          • That makes some sense except that CFML engines DO emulate CGI and provide a CGI scope containing the fields you would expect. For point 2 I do not want seperate "contexts" based on the FQDN used by the client. What I want is many FQDN aliases all pointing to the same "shortname" context. I do want to preserve the 'Host' header information but I need the "true" ServerName as well.

            – SpliFF
            Feb 3 '14 at 4:31











          • Hmm. You'll have to get it elsewhere, then, I think. Perhaps that mysterious header you mentioned? It should only take a moment to test whether that behaves the way you expect.

            – Michael Hampton
            Feb 3 '14 at 4:32











          • Thanks but I think you're too quick to assume the original server_name value isn't being passed through because this is "not CGI". I don't think that's the issue at all. I think it is being overwritten at some point in the httpd -> mod_proxy -> mod_cfml -> tomcat -> railo processing chain and I can probably prevent that if I knew where.

            – SpliFF
            Feb 3 '14 at 4:45











          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%2f571740%2fapache-usecanonicalname-on-isnt-passing-servername-to-cgi%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









          0














          You're not calling a CGI, you're proxying, so trying to set SERVER_NAME is either useless or very close to it.



          Typically with mass virtual hosting you should use the actual domain name that you received, which is HTTP_HOST, the Host: HTTP header, in your application to make the distinction.






          share|improve this answer























          • That makes some sense except that CFML engines DO emulate CGI and provide a CGI scope containing the fields you would expect. For point 2 I do not want seperate "contexts" based on the FQDN used by the client. What I want is many FQDN aliases all pointing to the same "shortname" context. I do want to preserve the 'Host' header information but I need the "true" ServerName as well.

            – SpliFF
            Feb 3 '14 at 4:31











          • Hmm. You'll have to get it elsewhere, then, I think. Perhaps that mysterious header you mentioned? It should only take a moment to test whether that behaves the way you expect.

            – Michael Hampton
            Feb 3 '14 at 4:32











          • Thanks but I think you're too quick to assume the original server_name value isn't being passed through because this is "not CGI". I don't think that's the issue at all. I think it is being overwritten at some point in the httpd -> mod_proxy -> mod_cfml -> tomcat -> railo processing chain and I can probably prevent that if I knew where.

            – SpliFF
            Feb 3 '14 at 4:45















          0














          You're not calling a CGI, you're proxying, so trying to set SERVER_NAME is either useless or very close to it.



          Typically with mass virtual hosting you should use the actual domain name that you received, which is HTTP_HOST, the Host: HTTP header, in your application to make the distinction.






          share|improve this answer























          • That makes some sense except that CFML engines DO emulate CGI and provide a CGI scope containing the fields you would expect. For point 2 I do not want seperate "contexts" based on the FQDN used by the client. What I want is many FQDN aliases all pointing to the same "shortname" context. I do want to preserve the 'Host' header information but I need the "true" ServerName as well.

            – SpliFF
            Feb 3 '14 at 4:31











          • Hmm. You'll have to get it elsewhere, then, I think. Perhaps that mysterious header you mentioned? It should only take a moment to test whether that behaves the way you expect.

            – Michael Hampton
            Feb 3 '14 at 4:32











          • Thanks but I think you're too quick to assume the original server_name value isn't being passed through because this is "not CGI". I don't think that's the issue at all. I think it is being overwritten at some point in the httpd -> mod_proxy -> mod_cfml -> tomcat -> railo processing chain and I can probably prevent that if I knew where.

            – SpliFF
            Feb 3 '14 at 4:45













          0












          0








          0







          You're not calling a CGI, you're proxying, so trying to set SERVER_NAME is either useless or very close to it.



          Typically with mass virtual hosting you should use the actual domain name that you received, which is HTTP_HOST, the Host: HTTP header, in your application to make the distinction.






          share|improve this answer













          You're not calling a CGI, you're proxying, so trying to set SERVER_NAME is either useless or very close to it.



          Typically with mass virtual hosting you should use the actual domain name that you received, which is HTTP_HOST, the Host: HTTP header, in your application to make the distinction.







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Feb 3 '14 at 4:21









          Michael HamptonMichael Hampton

          174k27319644




          174k27319644












          • That makes some sense except that CFML engines DO emulate CGI and provide a CGI scope containing the fields you would expect. For point 2 I do not want seperate "contexts" based on the FQDN used by the client. What I want is many FQDN aliases all pointing to the same "shortname" context. I do want to preserve the 'Host' header information but I need the "true" ServerName as well.

            – SpliFF
            Feb 3 '14 at 4:31











          • Hmm. You'll have to get it elsewhere, then, I think. Perhaps that mysterious header you mentioned? It should only take a moment to test whether that behaves the way you expect.

            – Michael Hampton
            Feb 3 '14 at 4:32











          • Thanks but I think you're too quick to assume the original server_name value isn't being passed through because this is "not CGI". I don't think that's the issue at all. I think it is being overwritten at some point in the httpd -> mod_proxy -> mod_cfml -> tomcat -> railo processing chain and I can probably prevent that if I knew where.

            – SpliFF
            Feb 3 '14 at 4:45

















          • That makes some sense except that CFML engines DO emulate CGI and provide a CGI scope containing the fields you would expect. For point 2 I do not want seperate "contexts" based on the FQDN used by the client. What I want is many FQDN aliases all pointing to the same "shortname" context. I do want to preserve the 'Host' header information but I need the "true" ServerName as well.

            – SpliFF
            Feb 3 '14 at 4:31











          • Hmm. You'll have to get it elsewhere, then, I think. Perhaps that mysterious header you mentioned? It should only take a moment to test whether that behaves the way you expect.

            – Michael Hampton
            Feb 3 '14 at 4:32











          • Thanks but I think you're too quick to assume the original server_name value isn't being passed through because this is "not CGI". I don't think that's the issue at all. I think it is being overwritten at some point in the httpd -> mod_proxy -> mod_cfml -> tomcat -> railo processing chain and I can probably prevent that if I knew where.

            – SpliFF
            Feb 3 '14 at 4:45
















          That makes some sense except that CFML engines DO emulate CGI and provide a CGI scope containing the fields you would expect. For point 2 I do not want seperate "contexts" based on the FQDN used by the client. What I want is many FQDN aliases all pointing to the same "shortname" context. I do want to preserve the 'Host' header information but I need the "true" ServerName as well.

          – SpliFF
          Feb 3 '14 at 4:31





          That makes some sense except that CFML engines DO emulate CGI and provide a CGI scope containing the fields you would expect. For point 2 I do not want seperate "contexts" based on the FQDN used by the client. What I want is many FQDN aliases all pointing to the same "shortname" context. I do want to preserve the 'Host' header information but I need the "true" ServerName as well.

          – SpliFF
          Feb 3 '14 at 4:31













          Hmm. You'll have to get it elsewhere, then, I think. Perhaps that mysterious header you mentioned? It should only take a moment to test whether that behaves the way you expect.

          – Michael Hampton
          Feb 3 '14 at 4:32





          Hmm. You'll have to get it elsewhere, then, I think. Perhaps that mysterious header you mentioned? It should only take a moment to test whether that behaves the way you expect.

          – Michael Hampton
          Feb 3 '14 at 4:32













          Thanks but I think you're too quick to assume the original server_name value isn't being passed through because this is "not CGI". I don't think that's the issue at all. I think it is being overwritten at some point in the httpd -> mod_proxy -> mod_cfml -> tomcat -> railo processing chain and I can probably prevent that if I knew where.

          – SpliFF
          Feb 3 '14 at 4:45





          Thanks but I think you're too quick to assume the original server_name value isn't being passed through because this is "not CGI". I don't think that's the issue at all. I think it is being overwritten at some point in the httpd -> mod_proxy -> mod_cfml -> tomcat -> railo processing chain and I can probably prevent that if I knew where.

          – SpliFF
          Feb 3 '14 at 4:45

















          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%2f571740%2fapache-usecanonicalname-on-isnt-passing-servername-to-cgi%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

          Wikipedia:Vital articles Мазмуну Biography - Өмүр баян Philosophy and psychology - Философия жана психология Religion - Дин Social sciences - Коомдук илимдер Language and literature - Тил жана адабият Science - Илим Technology - Технология Arts and recreation - Искусство жана эс алуу History and geography - Тарых жана география Навигация менюсу

          Bruxelas-Capital Índice Historia | Composición | Situación lingüística | Clima | Cidades irmandadas | Notas | Véxase tamén | Menú de navegacióneO uso das linguas en Bruxelas e a situación do neerlandés"Rexión de Bruxelas Capital"o orixinalSitio da rexiónPáxina de Bruselas no sitio da Oficina de Promoción Turística de Valonia e BruxelasMapa Interactivo da Rexión de Bruxelas-CapitaleeWorldCat332144929079854441105155190212ID28008674080552-90000 0001 0666 3698n94104302ID540940339365017018237

          What should I write in an apology letter, since I have decided not to join a company after accepting an offer letterShould I keep looking after accepting a job offer?What should I do when I've been verbally told I would get an offer letter, but still haven't gotten one after 4 weeks?Do I accept an offer from a company that I am not likely to join?New job hasn't confirmed starting date and I want to give current employer as much notice as possibleHow should I address my manager in my resignation letter?HR delayed background verification, now jobless as resignedNo email communication after accepting a formal written offer. How should I phrase the call?What should I do if after receiving a verbal offer letter I am informed that my written job offer is put on hold due to some internal issues?Should I inform the current employer that I am about to resign within 1-2 weeks since I have signed the offer letter and waiting for visa?What company will do, if I send their offer letter to another company