You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Grigoris Ioannou <ho...@gmail.com> on 2008/08/01 10:25:38 UTC

T5 application behaviour behind an apache web server

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

Re: T5 application behaviour behind an apache web server

Posted by Grigoris Ioannou <ho...@gmail.com>.
Finally this solved the problem: I used both of your suggestions:

I replaced ROOT.war with my application and
I set "tapestry.suppress-redirect-from-action-requests" to true

This seems to solve the problem.

Thanks,
Grigoris

On Fri, Aug 1, 2008 at 4:18 PM, Jonathan Barker <jonathan.theitguy@gmail.com
> wrote:

>
> I've used a different technique for the apache->jboss connection, but faced
> the same problem.
>
> Unless someone else has a better solution, you can replace the ROOT.war in
> the JBoss tomcat service with your application.
>
> Jonathan
>
>
>

RE: T5 application behaviour behind an apache web server

Posted by Jonathan Barker <jo...@gmail.com>.
I've used a different technique for the apache->jboss connection, but faced
the same problem.

Unless someone else has a better solution, you can replace the ROOT.war in
the JBoss tomcat service with your application.

Jonathan

> -----Original Message-----
> From: nkons1@gmail.com [mailto:nkons1@gmail.com] On Behalf Of Grigoris
> Ioannou
> Sent: Friday, August 01, 2008 04:26
> To: Tapestry users
> Subject: T5 application behaviour behind an apache web server
> 
> 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: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: T5 application behaviour behind an apache web server

Posted by Carl Crowder <ca...@taptu.com>.
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: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org