I'm running a Spring Web App in WebSphere Application Server (WAS). WAS is listening on port 36500 using https, Apache is listening on port 80 using http. The protocols in use are out of my control right now so I can't make Apache use https (which would solve the problem I'll describe below).
I have set up Apache as a reverse proxy to forward all requests to WAS on the specified port as follows:
Listen 80
LogLevel warn
LoadModule ssl_module modules/mod_ssl.so
SSLProxyEngine on
<VirtualHost _default_:80>
ProxyPreserveHost on
ServerName ech-10-157-131-139
LogFormat "%h %l %u %t \"%r\" %>s %b" common
CustomLog logs/access_log common
ErrorLog logs/error_log
<Location /sel>
Header set Host ech-10-157-131-139.mycompany.int
Header set Access-Control-Allow-Origin "*"
ProxyPass https://ech-10-157-131-139.mycompany.int:36500/sel
ProxyPassReverse https://ech-10-157-131-139.mycompany.int:36500/sel
</Location>
</VirtualHost>
This works fine and the JSON returned by WAS through the Apache proxy is mapping the URL of the Apache server into the links
section at the bottom of the output. However, the protocol on these links
elements is https, presumably because WAS is serving via https. Is there anything I can do in either WAS or Apache to alter these to http? There is some sample output below.
This request:
http://ech-10-157-131-139.mycompany.int/sel/services?endingHoursAgo=0&hoursToShow=2
results in this response (I've reduced the amount of data for brevity):
{
"content": [
{
"cpuUsageId": 132291,
"cpuUsageTimestamp": 1414583402385,
"deviceName": "dev",
"domainName": "DEVESB",
"tenSecondPercentage": 3,
"oneMinutePercentage": 3,
"tenMinutePercentage": 4,
"oneHourPercentage": 4,
"oneDayPercentage": 4,
"responseTimestamp": "2014-10-29 06:50:15",
"links": []
},
],
"links": [
{
"rel": "self",
"href": "https://ech-10-157-131-139.mycompany.int/sel/cpu?from=2014-10-29T06:50:00.000-05:00&to=2014-10-29T08:50:00.000-05:00"
}
]
}
You can see that the self
link above has a href
value starting with 'https'. I want WAS to return this as 'http' instead.