I've had a similar problem. It's because when Jetty redirects you, it
uses "request.getServerName()" and the request context to create a
complete URL. So if you go to your app at "http://localhost/page";, and
that sends a redirect, Jetty will redirect you to
"http://localhost/whatever";.

The problem comes with Apache's proxy because the server name and
context that Jetty sees is the server name and context that Apache is
requesting, not the user. This means that the redirects it builds which
get sent to the user are pointing at the wrong place.

My Apache proxy config was set up to proxy "https://externalurl/"; by
requesting "http://127.0.0.1/myapp"; which meant whenever I submitted a
form or anything else which required a redirect, I got sent to 127.0.0.1.

I got around the problem temporarily by setting
"tapestry.suppress-redirect-from-action-requests" to true, which
prevented it using redirects in most of the situations. However, that's
not ideal. I'm planning on simply having Jetty handle the requests
directly, which again isn't ideal but it's the best I can come up with.

I haven't been able to work out how to get Jetty to simply use a base
URL that I tell it to. Does any one know this? If not, I could just
patch Jetty myself, but again, it's not ideal...

Carl


Grigoris Ioannou wrote:
> Hi all,
> 
> I'm facing this peculiar behavior in my T5 application:
> 
> I have a search box in the border of the application:
> 
> BorderHeadComponent.tml
>         <t:form>
>           <t:textfield t:id="search" value="query" size="20" /> <t:submit
> t:id="submitQueryButton" value="Search"/>
>         </t:form>
> 
> BorderHeadComponent.java
>     @InjectPage
>     private ResultsPage resultsPage;
> 
>     Object onSuccess() {
>         resultsPage.setQuery(getQuery());
>         return resultsPage;
>     }
> 
> ResultsPage.java:
>     @Property
>     @Persist("flash")
>     private String query;
> 
>     void onActivate() {
>         LOGGER.info("came here with query " + getQuery());
>     }
> 
> 
> When I run the application in jboss and I search for something, it will
> correctly redirect me to http://localhost:8080/myapp/resultspage
> Ok till here, all works fine with jboss.
> 
> The problem starts in the live deployment. For the live environment, I have
> configured apache to redirect all requests to jboss. In httpd.conf, I write:
> ProxyPass / ajp://localhost:8009/myapp/
> ProxyPassReverse / ajp://localhost:8009/myapp/
> 
> So, theoretically, a search in the live site should redirect me to
> 
> http://www.mydomain.com/resultspage
> 
> But instead of this, it redirects to
> 
> http://www.mydomain.com/myapp/resultspage
>                                        (   ^  myapp should not appear here!
> )
> 
> which results in a 404 not found error.
> 
> Meanwhile, all the pagelinks (eg. <t:pagelink
> t:page="Start">Home</t:pagelink> ) function correctly.
> 
> Is this a Tapestry bug or a configuration error? Or am I missing something?
> I would appreciate any suggestions.
> 
> Grigoris
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to