Reputation: 212
I have put a health.html file in /var/www/html and tried to open using http://localhost/health.html but it is going to app-server-endpoint so giving 404 error. How do I change my apache configuration to be able to serve the static files present in DocumentRoot without going to app-server-endpoint which is configured using ProxyPass.
Apache version details:
Server version: Apache/2.4.6 (Red Hat Enterprise Linux)
Server built: Jun 22 2018 01:19:25
Here is my httpd.conf file:
ServerRoot "/etc/httpd"
Listen 80
Include conf.modules.d/*.conf
User apache
Group apache
ServerAdmin root@localhost
ServerName localhost
<Directory />
AllowOverride none
Require all denied
</Directory>
DocumentRoot "/var/www/html"
<Directory "/var/www">
AllowOverride None
Require all granted
</Directory>
<Directory "/var/www/html">
Options Indexes FollowSymLinks
AllowOverride None
Require all granted
Order allow,deny
Allow from all
</Directory>
<VirtualHost _default_:80>
DocumentRoot "/var/www/html"
</VirtualHost>
<IfModule dir_module>
DirectoryIndex index.html
</IfModule>
<Files ".ht*">
Require all denied
</Files>
ErrorLog "logs/error_log"
LogLevel warn
<IfModule log_config_module>
LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
LogFormat "%h %l %u %t \"%r\" %>s %b" common
<IfModule logio_module>
LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" %I %O" combinedio
</IfModule>
CustomLog "logs/access_log" combined
</IfModule>
<IfModule alias_module>
ScriptAlias /cgi-bin/ "/var/www/cgi-bin/"
</IfModule>
<Directory "/var/www/cgi-bin">
AllowOverride None
Options None
Require all granted
</Directory>
<IfModule mime_module>
TypesConfig /etc/mime.types
AddType application/x-compress .Z
AddType application/x-gzip .gz .tgz
AddType text/html .shtml
AddOutputFilter INCLUDES .shtml
</IfModule>
AddDefaultCharset UTF-8
<IfModule mime_magic_module>
MIMEMagicFile conf/magic
</IfModule>
EnableSendfile on
IncludeOptional conf.d/*.conf
RewriteEngine ON
ProxyRequests Off
ProxyPreserveHost On
KeepAlive ON
KeepAliveTimeout 15
Timeout 6000
ProxyTimeout 6000
AddOutputFilterByType DEFLATE text/html text/plain
DeflateCompressionLevel 9
BrowserMatch ^Mozilla/4 gzip-only-text/html
BrowserMatch ^Mozilla/4\.0[678] no-gzip
BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
DeflateFilterNote ratio
SetEnv proxy-sendcl
SetEnv proxy-sendchunks
TraceEnable Off
ExpiresActive On
ExpiresDefault "access plus 30 minutes"
ExpiresByType text/html "access plus 0 minutes"
ExpiresByType text/css "access plus 1 day"
ExpiresByType text/javascript "access plus 1 day"
ExpiresByType text/x-json "access plus 1 day"
ExpiresByType image/gif "access plus 1 month"
ExpiresByType image/png "access plus 1 month"
ExpiresByType image/jpg "access plus 1 month"
ExpiresByType image/jpeg "access plus 1 month"
<FilesMatch ".(gif|jpg|jpeg|png|flv|swf|ico|js|css|pdf)$">
Header add Cache-Control "max-age=315360000, public"
</FilesMatch>
Header add X-Frame-Options "SAMEORIGIN"
Header unset Server
ServerTokens Prod
ServerSignature Off
Header set Access-Control-Allow-Origin "POST"
ProxyPassMatch ^/(.*) http://<app-server-endpoint>:8080
ProxyPassReverse / http://<app-server-endpoint>:8080
Upvotes: 0
Views: 1801
Reputation: 212
I have added the following code just before ProxyPassMatch ^/(.*) http://<app-server-endpoint>:8080
and it solved the issue.
ProxyPass /health.html !
Upvotes: 0