Apache httpd and apache tomcat hide application name

假设你已经设置了apache httpd 代理(proxy)你的tomcat。

假设你现在的程序地址是http://www.example1.com/docs,你想要把这个地址变成http://www.example1.com

<VirtualHost *:80>
DocumentRoot "/var/www/example1.com/public_html/"
ServerName www.example1.com
ServerAlias example1.com
ErrorLog /var/www/example1.com/error.log
LogLevel info
CustomLog /var/www/example1.com/access.log combined

ProxyPass "/docs" "http://localhost:8080/docs"
ProxyPassReverse "/docs" "http://localhost:8080/docs"

RewriteEngine on
Options FollowSymLinks
RewriteLog "/var/log/httpd/rewrite.log"
RewriteLogLevel 3

#RewriteCond "%{REMOTE_ADDR}" "^192\.168\.56\.101"

#[NC] case-insensitive manner
RewriteCond %{HTTP_HOST}   ^www\.example1\.com [NC]
#RewriteRule "^/vhosterrors" "/var/www/example1.com/error.log"

#[L] end if matched
#RewriteRule "^/" "/var/www/example1.com/downtime.html" [L]

#[P] proxy
RewriteRule ^(/.*) http://localhost:8080/docs/$1 [P]
</VirtualHost>

 

Apache tomcat URL rewrite

Reference : https://www.systemcodegeeks.com/web-servers/apache/apache-mod_rewrite-example/

Why do we make commitment

Creating a language of commitment my sound a bit of scary, but it can help solve many of communication problems programmers face today – estimations, deadlines, and face-to-face communication mishaps. You’ll be taken as a serious developer who lives up to their word, that’s one of the best things you can hope for in our industry.

— From “The Clean Coder” , A code of Conduct for Professional Programmers.