apache: how do you redirect a url with a reverse proxy setup?

Viewed 14

Background: I have an application called geoserver that is hidden behind an apache server (apache server acting as a reverse proxy). There is a specific endpoint that when users hit, i am trying to redirect to another endpoint.

so when a user tried to go to http://geoserver:8080/geoserver/ it always gets redirected to http://geoserver:8080/geoserver/web/

The reason i want this is because sensitive information is revealed at that original endpoint and users should always be directed to geoserver/web when trying to hit that.

How do you use the apache Redirect directive to do what I am trying to do?

Below is the code that i am working with

ProxyPreserveHost on
  ProxyAddHeaders on

 
    ProxyPass /geoserver http://localhost:8080/userinfo
    ProxyPassReverse /geoserver http://localhost:8080/userinfo
    <Location /geoserver> 
      RequestHeader set X-gsusername %{oidc_claim_username}e
      RequestHeader set X-gsroles "unclass"
    </Location>

  # /userinfo
  # Manipulate user info in request headers into GeoServer X-gsusername and X-gsroles request headers
    ProxyPass /userinfo http://geoserver:8080/geoserver
    ProxyPassReverse /userinfo http://geoserver:8080/geoserver
    # Change request headers
    <Location /userinfo>
      # If the user countryofaffiliation is USA, then append role fouo
      SetEnvIf oidc_claim_countryofaffiliation "USA" fouo
      RequestHeader merge X-gsroles "fouo" env=fouo
      RequestHeader edit* X-gsroles "," ";"
      Redirect "/geoserver" GeoServerPrivateUrlValue/web
    </Location>
0 Answers
Related