Use "Redirect" and "ProxyPass"

I would like to force my users to use https to log in. Unfortunately, the "redirect" directive does not seem to work in conjunction with "ProxyPass"

<VirtualHost *:80>
  ServerName www.domain.com
  # This does not work
  Redirect permanent /app/login.jsp https://www.domain.com/app/login.jsp
  ProxyPass         /app    http://localhost:8080/app
  ProxyPassReverse  /app    http://localhost:8080/app
</VirtualHost>

Any idea? Thank.

+4
source share
3 answers

The answer to this question is found here:

https://serverfault.com/questions/605931/can-you-use-redirect-and-proxypass-at-the-same-time

The following requirements must be added before other proxypass directives:

ProxyPass / app / login.jsp!

+5
source

I had a more complicated use case and it required use ProxyPassMatch. This is a bit like this:

ProxyPassMatch ^/app(/(index.html)?)?$ !
RedirectMatch ^/app(/(index.html)?)?$ /path/to/login/page.html

ProxyPass /app/* http://remote-server/app
ProxyPassReverse /app/* http://remote-server/app

ProxyPassMatch, ProxyPass . , ProxyPassMatch $ .

RewriteMatch , Redirect -. .

+1

, , ProxyPass /app, , .

ProxyPass RewriteRule [P]:

<VirtualHost *:80>
  ServerName www.domain.com

  RewriteRule ^/(app/login.jsp)$ https://www.domain.com/$1 [R=301,L]
  RewriteRule ^/app(.*) http://localhost:8080/app$1 [P]

  ProxyPassReverse /app http://localhost:8080/app

</VirtualHost>
0

All Articles