我试图让grails应用程序在两个不同的域下运行 - test.com/myapp
和test.org/myapp
。 host
网址中的Config.groovy
指向https://test.com/myapp
当我转到test.org/myapp
时,它会正确进入主页,当我尝试登录时,会发生什么?重定向到第一个域。我想这与弹簧安全和路径生成有关。为了解决这个问题,我有哪些选择?
这是我的myapp.conf
,但如果您需要其他数据,请在评论中告诉我
Alias /.well-known/acme-challenge/ "/var/www/html/certbot/.well-known/acme-challenge/"
<Directory "/.well-known/acme-challenge/">
Options -Indexes -MultiViews
AllowOverride None
Order allow,deny
Allow from all
</Directory>
<VirtualHost *:80>
ServerName test.com
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
</VirtualHost>
<VirtualHost *:443>
ServerName test.com
ServerAlias www.test.com
DocumentRoot /var/www/html/honeypot/
RewriteEngine On
php_flag engine off
RemoveHandler .cgi .php .php3 .php4 .php5 .phtml .pl .py .pyc .pyo
JkMount /* worker1
JkUnMount /myapp/files/* worker1
Alias "/myapp/files" "/var/www/myapp/files"
<Directory "/myapp/files">
allow from all
Options -Indexes
AllowOverride None
</Directory>
SSLEngine on
SSLCertificateFile /etc/letsencrypt/live/test.com/cert.pem
SSLCertificateKeyFile /etc/letsencrypt/live/test.com/privkey.pem
SSLCertificateChainFile /etc/letsencrypt/live/test.com/chain.pem
SSLProxyEngine on
ProxyPreserveHost On
ProxyPassMatch ^/myap(.+)$ !
ProxyPass / https://myserver.com/
ProxyPassReverse / https://myserver.com/
</VirtualHost>
更新
grails.serverURL = https://test.com/myapp
答案 0 :(得分:0)
也许您应该发布spring-security的配置。假设存在这个问题,有不同的方法来解决它。一个是您可以使用grails.config.locations在Grails应用程序中设置外部配置(请参阅http://docs.grails.org/2.5.4/guide/single.html#configExternalized)然后在服务器上的外部文件中覆盖Spring Security的应用程序设置grails.config.locations是参考
这允许您单独管理应用程序配置,但部署相同的战争。然后,您可以通过某些配置管理系统管理外部文件,例如Puppet。