Mod rewrite 如何使用mellon身份验证设置apache反向代理

Mod rewrite 如何使用mellon身份验证设置apache反向代理,mod-rewrite,apache2,reverse-proxy,mod-auth,mellon,Mod Rewrite,Apache2,Reverse Proxy,Mod Auth,Mellon,我正在尝试使用Mellon身份验证的反向代理。我已经启用了mod_重写和mod_代理模块 应用程序的实际URL:“https://elkdev.automation.pega.io" 下面是443端口上的apache配置文件: RewriteEngine on RewriteCond %{HTTP_REFERER} ^https://login.microsoftonline.com/$ [NC] RewriteRule ^(/.*)?$ http://elkdevhost.automatio

我正在尝试使用Mellon身份验证的反向代理。我已经启用了mod_重写和mod_代理模块

应用程序的实际URL:“https://elkdev.automation.pega.io"

下面是443端口上的apache配置文件:

RewriteEngine on

RewriteCond %{HTTP_REFERER} ^https://login.microsoftonline.com/$ [NC]
RewriteRule ^(/.*)?$ http://elkdevhost.automation.pega.io:5601/ [P]
ProxyPassReverse / http://elkdevhost.automation.pega.io:5601/

<Location />
    Require valid-user
    AuthType "Mellon"
    MellonEnable "auth"
    MellonSPMetadataFile "/etc/apache2/saml2/mellon_metadata.xml"
    MellonSPPrivateKeyFile "/etc/apache2/saml2/mellon.key"
    MellonSPCertFile "/etc/apache2/saml2/mellon.crt"
    MellonIdPMetadataFile "/etc/apache2/saml2/idp_metadata.xml"
</Location>


重新编写引擎打开
重写cond%{HTTP_REFERER}^https://login.microsoftonline.com/$[NC]
重写规则^(/.*)?$http://elkdevhost.automation.pega.io:5601/ [P]
ProxyPassReverse/http://elkdevhost.automation.pega.io:5601/
需要有效用户
AuthType“Mellon”
可编辑的“auth”
MellonsMetadataFile“/etc/apache2/saml2/mellon_metadata.xml”
MellonsPrivateKeyFile“/etc/apache2/saml2/mellon.key”
MellonsCertFile“/etc/apache2/saml2/mellon.crt”
MellonIdPMetadataFile“/etc/apache2/saml2/idp_metadata.xml”
当我点击应用程序URL时,页面被重定向到IDP身份验证页面(Microsoft),配置为位置。身份验证完成后,IDP页面回复URL将是与初始URL相同的应用程序URL()。因此请求再次返回到同一页面,所以现在为了区分请求,我使用了HTTP\u REFFERER标志和RewriteCond。当此条件匹配时,将执行重写规则,因此放置代理URL

这里,用[p]重写规则不起作用,并给出404错误

重写规则^(/.*)$[p]

使用[R]标记,它将正确重定向到给定的URL。但URL也在改变(正如预期的那样)

重写规则^(/.*)?$[R]

我的问题是,当我使用[p]标志时,为什么它不代理