0

Using Apache HTTPD 2.2 web server in RHEL 6 with Name based virtual hosting. Trying to configure the Proxy for one of my web site . (FYI: its for kibana dashboard)

<VirtualHost 192.168.12.20:80>
    ServerName admin.kibana.com
    ServerAlias www.admin.kibana.com
    DocumentRoot /opt/kibana
    <Directory />
            Options FollowSymLinks
            AllowOverride None
    </Directory>
    <Directory /opt/kibana>
            Options -Indexes FollowSymLinks -MultiViews
            AllowOverride all
            Order allow,deny
            allow from all
    </Directory>

    ErrorLog logs/admin.error.log
    LogLevel error
    CustomLog logs/admin.log combined

    ProxyRequests off
    ProxyPreserveHost On
    ProxyVia On

    <Proxy *>
    Order deny,allow
    Allow from all
    </Proxy>

    ProxyPass / http://192.168.12.20:5601/
    ProxyPassReverse / http://192.168.12.20:5601/

</VirtualHost>

Have the local host entry in C:\Windows\System32\drivers\etc\hosts and able to view the page and content and everything is working fine.

192.168.12.20  admin.kibana.com  www.admin.kibana.com

Now the actual problem comes. Even if I try to browse below domains still web page is being served

kibana.com
admin-kibana-com

Using Rewrite rules helps me, however it stops serving the actual application from back-end server. Can I do something with only using Proxy and virtual host configuration? please suggest. thanks in advance.

0

if you only have 1 Virtualhost this will be used as a fallback for all the requests. what you can do:

  • a RewriteRule that reject all other domains. If yours doesn't work maybe you got it wrong.

  • another VirtualHost that will be the default and will always give back 503

https://httpd.apache.org/docs/current/vhosts/examples.html#purename

  • Will create 2 virtual hosts or more in future. Its pain full, however understood your point. hint is who becomes your default host, if nothing matches. Solution is: in the httpd.conf use default virtual host section and then 1. define all the possible host names and redirect them to custom or error page. 2. if you hate predicting the host name, use regex with rewrite rules which can exclude the domain which we are using for actual virtual hosts. Thanks @diego Roccia – Himanshu Dubey Sep 8 '17 at 8:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.