• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Redirect behind proxy

 
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I try to do a redirect between actions, the application is behind an apache proxy ,that makes it a bit complicated. In myaction:
ActionForward forward= new ActionForward("/myotheraction.do");
forward.setRedirect(true);
return forward;

The url that i use through proxy is https://machine:8443/myapp/myaction.do.
So when I make the redirect in my action, i would like to keep that url, but the url change to the application server url: http://appmachine:11704/myapp/myotheraction.

How can i fool struts to keep the proxy url? I don't wan't to do forward action.One solution is to use absolute url, but is there another way?
 
Ranch Hand
Posts: 190
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
<html:base />
 
robert isidorson
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I tried that, but I loose that information when creating a new actionforward in myaction. If i could, i would like to modify the response headers before returning, but i cant do that with ActionForwards.
 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Sorry to resurrect an old thread, but I have a similar issue, and I can't seem to find a resolution. I’ve inherited a Struts 1.1 application, and could use some assistance.

As above, after a user submits a form, the application does a redirect. That is causing the browser to attempt to reach the application server hosting the application (http://appserver:8080/MyApp), not the external Apache 1.3 web server that front-ends it (https://webserver/MyApp).

So for example:
The user logs in and goes through a series of screens. These are traversed using a standard FORWARD, which works fine. The user then fills in a form at https://webserver/MyApp/ObjectiveWizard3.jsp which posts to
/MyApp/saveObjective.do, which then REDIRECTS to /MyApp/objectivesEditor.do. This redirect is hard-coded in the application, not in the struts-config.xml.

The problem is that the app server then sends back a “302 Moved Temporarily” response with Location: http://appserver:8080/MyApp/objectivesEditor.do
I tried using <html:base />, but it is inserting a <base> tag referring to appserver, not webserver.
This is despite having in default-web-site.xml:
<frontend host="webserver" port="443" />

The application server is Oracle AS10g (10.1.2), which has an Apache (OHS) instance listening on 8080, connected to a J2EE container on 12053 using AJP 1.3. The external web server is on a Solaris box, and refers to the internal application server by IP, because it isn't even visible on the domain controller or entered into the hosts file. There's a firewall between these two boxes, with the requisite ports opened.

We have the following in the httpd.conf on the external Apache instance:
ProxyPass /MyApp/ http://10.1.1.2:8080/MyApp/
ProxyPassReverse /MyApp/ http://10.1.1.2:8080/MyApp/
(where 10.1.1.2 is a representation of the internal IP address of the AS10g box and 8080 is the port that the OHS is listening on.)

Previously, it was deployed to an Oracle Containers for J2EE (OC4J) 9.0.4 container on Solaris, front-ended by the same Apache 1.3 on another Solaris box.

I haven't done any Struts work in a few years, and am at a loss here . Any ideas are welcomed!
 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Robert, did you find a resolution for this issue?
 
Bartender
Posts: 9626
16
Mac OS X Linux Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Michelle:
Given that this topic is over a decade old, I don't think anyone else will be contributing to it.  You may want to create a new topic describing your particular situation so we can better address your issues.
If you are using Tomcat, you may want to look at the ProxyName and ProxyPort parameters of your Connector configuration see here
reply
    Bookmark Topic Watch Topic
  • New Topic