Combined with the previous commit. If you use different domain names, you will encounter cross-origin requests...
Combine the previous http://www.2cto.com/ OS /201511/112841.html, and continue the resources of the separation sites to the different sites
If a java site uses a tomcat server, the css, images, and js of the site must be separated. If you use different domain names, you will encounter cross-domain situations. Therefore, apache Proxy is used for separation.
Put all css, images, and js resources
Src.test.com/css /......
Src.test.com/images /......
Src.test.com/js /......
Java site tomcat server access method
Ajp: // 127.0.0.1: 8009/
It is actually http: // 127.0.0.1: 8080/
Apache httpd. conf configuration
ServerName mnr.test.com
RewriteEngine on
RewriteRule ^/(. *) ajp: // www.2cto.com/sub/$1 [P]
Then access the site through http://sub.test.com
Because css, images, and js resources are independent domain names, they may be on other servers, but they must be called using the same domain name in the subdomain name to avoid cross-origin requests.
ServerName mnr.test.com
RewriteEngine on
ProxyPass/js/http://src.test.com/js/
ProxyPass/css/http://src.test.com/css/
ProxyPass/images/http://src.test.com/images/
RewriteRule ((?! /(Js) | (css) | (img)/) ^. * $) ajp: // 127.0.0.1: 8009/sub/$1 [P]
Restart apache
Call ING:
Sub.test.com/css src.test.com/css /......
Sub.test.com/images src.test.com/images /......
Sub.test.com/js src.test.com/js /......
All sub.test.com resources are resources under the tomcat directory.
Author bayaci