Issue setting environment variable in apache httpd.confHeader set Access-Control-Allow-Origin not working...

Where is the fallacy here?

Wrap all numerics in JSON with quotes

Can we carry rice to Japan?

What are all the squawk codes?

Did Amazon pay $0 in taxes last year?

Are small insurances worth it

Why are special aircraft used for the carriers in the united states navy?

Inverse of the covariance matrix of a multivariate normal distribution

Detect if page is on experience editor Sitecore 9 via Javascript?

Why is it "take a leak?"

Book about a time-travel war fought by computers

How to mitigate "bandwagon attacking" from players?

Dystopian novel where telepathic humans live under a dome

Forward slip vs side slip

Heating basement floor with water heater

What type of investment is best suited for a 1-year investment on a down payment?

What are the issues with an additional (limited) concentration slot instead of Bladesong?

Why do phishing e-mails use faked e-mail addresses instead of the real one?

Real life puzzle: Unknown alphabet or shorthand

If nine coins are tossed, what is the probability that the number of heads is even?

Didactic impediments of using simplified versions

Make me a metasequence

I can't die. Who am I?

How can I be pwned if I'm not registered on the compromised site?



Issue setting environment variable in apache httpd.conf


Header set Access-Control-Allow-Origin not working with mod_rewrite + mod_jkConditionally set an Apache environment variableConfiguring httpd.conf to handle both a website and subversionUsing an environment variable in mod_headers set by mod_rewriteHow can I use SetEnvIf to set a variable based on the Http Host?Can you use a windows enviroment variable in apache conf?Apache2 Environment Variables on CentOSHow To Tell Apache To Not Log Certain Requests In Its Access LogDeny access to apache virtual host to the outside worldhtaccess conditional header set is ignoring the condition













1















I'm trying to figure out why I can set a string literal in httpd.conf using SetEnv:



SetEnvIf anothertest ^$ something=sometext


But I can't assign the contents of another variable:



SetEnvIf anothertest ^$ something=$QUERY_STRING


The second one results in $QUERY_STRING instead of dereferencing the variable.



Update:



The above code was an attempt at troubleshooting an issue I'm having. The ultimate goal is to get the SetEnvIf working so that I can set multiple domains with Access-Control-Allow-Origin. I'm trying to set it for domain https://localhost:8443 and https://10.1.40.75:8443. Below is the code that I currently have which isn't working.



<ifModule mod_headers.c>
SetEnvIf Origin "^http(s)?://(.+.)?(localhost:8443|10.1.40.75:8443)$" origin_is=$0
Header always set Access-Control-Allow-Origin %{origin_is}e env=origin_is
Header set Access-Control-Allow-Credentials true
</ifModule>









share|improve this question
















bumped to the homepage by Community 22 mins ago


This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.




















    1















    I'm trying to figure out why I can set a string literal in httpd.conf using SetEnv:



    SetEnvIf anothertest ^$ something=sometext


    But I can't assign the contents of another variable:



    SetEnvIf anothertest ^$ something=$QUERY_STRING


    The second one results in $QUERY_STRING instead of dereferencing the variable.



    Update:



    The above code was an attempt at troubleshooting an issue I'm having. The ultimate goal is to get the SetEnvIf working so that I can set multiple domains with Access-Control-Allow-Origin. I'm trying to set it for domain https://localhost:8443 and https://10.1.40.75:8443. Below is the code that I currently have which isn't working.



    <ifModule mod_headers.c>
    SetEnvIf Origin "^http(s)?://(.+.)?(localhost:8443|10.1.40.75:8443)$" origin_is=$0
    Header always set Access-Control-Allow-Origin %{origin_is}e env=origin_is
    Header set Access-Control-Allow-Credentials true
    </ifModule>









    share|improve this question
















    bumped to the homepage by Community 22 mins ago


    This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.


















      1












      1








      1








      I'm trying to figure out why I can set a string literal in httpd.conf using SetEnv:



      SetEnvIf anothertest ^$ something=sometext


      But I can't assign the contents of another variable:



      SetEnvIf anothertest ^$ something=$QUERY_STRING


      The second one results in $QUERY_STRING instead of dereferencing the variable.



      Update:



      The above code was an attempt at troubleshooting an issue I'm having. The ultimate goal is to get the SetEnvIf working so that I can set multiple domains with Access-Control-Allow-Origin. I'm trying to set it for domain https://localhost:8443 and https://10.1.40.75:8443. Below is the code that I currently have which isn't working.



      <ifModule mod_headers.c>
      SetEnvIf Origin "^http(s)?://(.+.)?(localhost:8443|10.1.40.75:8443)$" origin_is=$0
      Header always set Access-Control-Allow-Origin %{origin_is}e env=origin_is
      Header set Access-Control-Allow-Credentials true
      </ifModule>









      share|improve this question
















      I'm trying to figure out why I can set a string literal in httpd.conf using SetEnv:



      SetEnvIf anothertest ^$ something=sometext


      But I can't assign the contents of another variable:



      SetEnvIf anothertest ^$ something=$QUERY_STRING


      The second one results in $QUERY_STRING instead of dereferencing the variable.



      Update:



      The above code was an attempt at troubleshooting an issue I'm having. The ultimate goal is to get the SetEnvIf working so that I can set multiple domains with Access-Control-Allow-Origin. I'm trying to set it for domain https://localhost:8443 and https://10.1.40.75:8443. Below is the code that I currently have which isn't working.



      <ifModule mod_headers.c>
      SetEnvIf Origin "^http(s)?://(.+.)?(localhost:8443|10.1.40.75:8443)$" origin_is=$0
      Header always set Access-Control-Allow-Origin %{origin_is}e env=origin_is
      Header set Access-Control-Allow-Credentials true
      </ifModule>






      apache-2.2 web-server http






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Apr 13 '13 at 20:54







      opike

















      asked Apr 13 '13 at 20:21









      opikeopike

      1137




      1137





      bumped to the homepage by Community 22 mins ago


      This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.







      bumped to the homepage by Community 22 mins ago


      This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
























          1 Answer
          1






          active

          oldest

          votes


















          0














          It's because Apache doesn't support that in the mod_setenvif module: http://httpd.apache.org/docs/2.2/mod/mod_setenvif.html



          If you let us know what you're trying to achieve, perhaps one of us can suggest an alternative solution?






          share|improve this answer
























          • Updated the original question...

            – opike
            Apr 13 '13 at 20:54











          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%2f499107%2fissue-setting-environment-variable-in-apache-httpd-conf%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














          It's because Apache doesn't support that in the mod_setenvif module: http://httpd.apache.org/docs/2.2/mod/mod_setenvif.html



          If you let us know what you're trying to achieve, perhaps one of us can suggest an alternative solution?






          share|improve this answer
























          • Updated the original question...

            – opike
            Apr 13 '13 at 20:54
















          0














          It's because Apache doesn't support that in the mod_setenvif module: http://httpd.apache.org/docs/2.2/mod/mod_setenvif.html



          If you let us know what you're trying to achieve, perhaps one of us can suggest an alternative solution?






          share|improve this answer
























          • Updated the original question...

            – opike
            Apr 13 '13 at 20:54














          0












          0








          0







          It's because Apache doesn't support that in the mod_setenvif module: http://httpd.apache.org/docs/2.2/mod/mod_setenvif.html



          If you let us know what you're trying to achieve, perhaps one of us can suggest an alternative solution?






          share|improve this answer













          It's because Apache doesn't support that in the mod_setenvif module: http://httpd.apache.org/docs/2.2/mod/mod_setenvif.html



          If you let us know what you're trying to achieve, perhaps one of us can suggest an alternative solution?







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Apr 13 '13 at 20:43









          JayJay

          5,9731529




          5,9731529













          • Updated the original question...

            – opike
            Apr 13 '13 at 20:54



















          • Updated the original question...

            – opike
            Apr 13 '13 at 20:54

















          Updated the original question...

          – opike
          Apr 13 '13 at 20:54





          Updated the original question...

          – opike
          Apr 13 '13 at 20:54


















          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%2f499107%2fissue-setting-environment-variable-in-apache-httpd-conf%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...

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