We were able to achieve this in IIS using below rewrite configuration, was
wondering if theres any module that I can use in apache to achieve the same.
<rewrite>
<outboundRules>
<rule name="Adjust context root" preCondition="matchReq">
<!--Check if the Response URI location from Application Redirect
starts with /gtaapp (Application context) and if so, prefix /services/gta as
required by Torbit-->
<match serverVariable="RESPONSE_LOCATION"
pattern="^(\/gtaapp\/)([\w\-\.]+[^#?\s]+)(.*)?(#[\w\-]+)?$" ignoreCase="true" />
<action type="Rewrite" value="/services/gta{RESPONSE_LOCATION}" />
</rule>
<preConditions>
<preCondition name="matchReq">
<!--Ensure the request is from external user. This can also be
determined based on a new HTTP header added by Torbit, if required-->
<add input="{HTTP_HOST}" pattern="^www.external.com$"
ignoreCase="true" />
</preCondition>
</preConditions>
</outboundRules>
</rewrite>
Naveen Reddy
Senior Systems Engineer Middleware Webservices – Cloud Middleware
Strati PaaS – Core Foundations
Cell: 479 321 4679
[email protected]<mailto:[email protected]>
From: Naveen Nandyala <[email protected]>
Reply-To: "[email protected]" <[email protected]>
Date: Monday, January 14, 2019 at 12:01 PM
To: "[email protected]" <[email protected]>
Subject: EXT: Re: [users@httpd] RE: Updating Response url from Apache
Thank you Matt for response.
We don’t have control on external proxy server its Torbit managed by other team.
We have all firewall rules opened and communications between internal and
external.
Below are request and response we are looking for.
Request ::
End user access this url in AEM (
https://www.external.com/services/gta/gtaapp/menu.jsp<https://cert-one.walmart.com/services/gta/gtaapp/menu.jsp>)
—> Torbit ( Proxy pass
https://www.external.com/services/gta/gtaapp/menu.jsp<https://cert-one.walmart.com/services/gta/gtaapp/menu.jsp>
—> https://www.internal.com/gtaapp/menu.jsp ) —> Apache 2.4
https://www.internal.com/gtaapp/menu.jsp —> WAS Application Server
((Application with context root “gtaapp” )
==============
Response ::
WAS Application Server (Application with context root “gtaapp” ) —> Apache 2.4
https://www.internal.com/gtaapp/menu.jsp (here we are looking to send response
as https://www.internal.com/services/gta/gtaapp/ based on HTTP_HOST in header
set to www.external.com<http://www.external.com> in Torbit) —> Torbit ( proxy
pass https://www.internal.com/services/gta/gtaapp/menu.jsp —>
https://www.external.com/services/gta/gtaapp/menu.jsp<https://cert-one.walmart.com/services/gta/gtaapp/menu.jsp>
—> AEM/Client
https://www.external.com/services/gta/gtaapp/menu.jsp<https://cert-one.walmart.com/services/gta/gtaapp/menu.jsp>
Internal users access application directly hitting Apache 2.4 virtual.
External users will access application from AEM which appends additional
context root “\services\gta” which is not actual context root of Application.
I’m looking to change https://www.internal.com/gtaapp/menu.jsp to
https://www.internal.com/services/gta/gtaapp/menu.jsp whenever apache sends
response back to torbit so that torbit can identify correct path in AEM and
load request to user as
https://www.external.com/services/gta/gtaapp/menu.jsp<https://cert-one.walmart.com/services/gta/gtaapp/menu.jsp>
Torbit passes HTTP_HOST with value as www.external.com<http://www.external.com>
in header so that I can filter based on http_host and do this only for the
requests coming from external so that it doesn’t affect internal users.
I tried to use substitute module which quiet didn’t work.
Substitute
"s|https://www.internal.com/gtaapp/|https://www.internal.com/services/gta/gtaapp/|i"
Naveen Reddy
From: "Muggeridge, Matt" <[email protected]>
Reply-To: "[email protected]" <[email protected]>
Date: Sunday, January 13, 2019 at 8:03 PM
To: "[email protected]" <[email protected]>
Subject: EXT: [users@httpd] RE: Updating Response url from Apache
There are bound to be other approaches, but one method is to configure the
www.external.com server as a reverse proxy. This assumes you have control of
the web server running on www.external.com.
Matt.
From: Naveen Nandyala [mailto:[email protected]]
Sent: Monday, 14 January 2019 11:25 AM
To: [email protected]
Subject: [users@httpd] Updating Response url from Apache
Hello Team,
We are currently using application internal to our network
using something like below
www.internal.com/<Application_Context_Root>/menu.jsp<http://www.internal.com/%3cApplication_Context_Root%3e/menu.jsp>
We are working to expose our application to external users we use an additional
component Adobe Experience manager for accessing application which appends and
additional context root in request header before even hitting our proxy server
in DMZ which proxies request to internal.
Now our request for external users will be.
www.external.com/services/app/<Application_Context_Root>/menu.jsp<http://www.external.com/services/app/%3cApplication_Context_Root%3e/menu.jsp>,
when it redirects to internal Apache web server and when internal web server
responds back to external its not appending additional context root in header
/services/app due to which it's failing.
I’m looking for my internal Apache web server to identify any request coming to
the internal Apache web server from www.external.com<http://www.external.com>
sends a response back to external by appending /services/app to the header
before Application_context_Root.
I think I may not be able to use rewrite module to achieve, I’m looking at
substitute module. Is there a way I can add a condition to substitute module
and append it to response header from apache?
Any request that comes to Apache from www.external.com<http://www.external.com>
or Proxy server should be filtered and in every response that apache sends to
this requests I need to add “/services/app” to header before application
context root.
Naveen Reddy
Senior Systems Engineer Middleware Webservices – Cloud Middleware
Strati PaaS – Core Foundations
Cell: 479 321 4679
[email protected]<mailto:[email protected]>