Score:0

Alias in apache httpd.conf

cn flag

I am trying to serve robots.txt on an existing https site being served via reverse proxy on an apache windows server.

Here is what I added to httpd.conf file however this is not working. What am I doing wrong.

# global robots.txt file 
<Location "/robots.txt">
    ProxyPass !
</Location>

Alias /robots.txt "C:\Ampps\www\robots.txt"

and here is what is in my httpd.ssl file:

AddType application/x-pkcs7-crl    .crlss phrase on stdout.
SSLPassPhraseDialog  builtin
SSLSessionCache        "shmcb:C:/Ampps/apache/logs/ssl_scache(512000)"
SSLSessionCacheTimeout  300
Mutex default
Timeout 2400
ProxyTimeout 2400
ProxyBadHeader Ignore 

<VirtualHost *:443>
    ServerName abc.org
    ProxyPreserveHost On
    ProxyPass "/" "http://127.0.0.1:8043/" nocanon retry=1 acquire=3000 timeout=600 Keepalive=On
    RequestHeader set "X-Forwarded-Proto" "https"

    ## SSL
    SSLEngine on
    SSLProxyEngine on
    SSLCertificateFile    "C:\ssl\abc_org.crt"
    SSLCertificateKeyFile "C:\ssl\abc_org.key"
    SSLCertificateChainFile "C:\ssl\DigiCertCA.crt"
</VirtualHost>
Score:0
la flag

The manual https://httpd.apache.org/docs/2.4/mod/mod_proxy.html#proxypass comes with the following warning:

Mixing ProxyPass settings in different contexts does not work:

  ProxyPass "/mirror/foo/i" "!"
  <Location "/mirror/foo/">
      ProxyPass "http://backend.example.com/"
  </Location>

or vice-versa. You can't have one part of your reverse proxy configuration in a location block and another part of your configuration used directly.

Either both the ProxyPass and the exclude need to be in enclosed in Location block, or both are called directly.

I slightly prefer to use ProxyPass directives directly rather than using the Location container and then AFAIK an exclude directive is additionally an example where the ordering of Apache httpd directives matters.

An exclude needs to be positioned before the ProxyPass directive it should be excluded from.

For example:

<VirtualHost *:443>
    ServerName example.org
    
    Alias /robots.txt "C:\Ampps\www\robots.txt"

    ProxyPass "/robots.txt" "!" 

    ProxyPass "/" "http://127.0.0.1:8043/" ...
    ProxyPassReverse "/" "http://127.0.0.1:8043/"
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.