You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Sergio Paganoni <se...@gmail.com> on 2013/09/26 11:22:54 UTC

Wicket - Apache URL rewrite Access-Control-Allow-Origin issue

Hi Everybody,

I'm facing a strange issue. I'm on UserPage on
http://account.dev.pippo.com/account/UserPage in this page I have a
DropDown component to filter a listview (using Ajax). When choosing a value
from the dropdown the XMLHttpRequest is done against
http://dev.pippo.cominstead of
http://account.dev.pippo.com/account. This leads to an
Access-Control-Allow-Origin problem:

XMLHttpRequest cannot load
https://dev.pippo.com/wicket/page?3-1.IBehaviorListener.0-c…ontentList-layout-contentRight-overview-dateRange-listViewDateRangeOptions.
Origin https://account.dev.pippo.com is not allowed by
Access-Control-Allow-Origin.

I have an Apache rewrite rule that prepend the account. URL when /account
is used.

The /account URL is mounted using:

mountPackage("/account", UserPage.class);

(I moved all panels and custom components used by this UserPage on the same
package)

Should't wicket use the current URL (http://account.dev.pippo.com/account/)
as target for the Ajax request (to avoid browser blocking the requests)?

In the markup file I have the following AJAX request
Wicket.Ajax.ajax({"u":"../wicket/page?3-1.IBehaviorListener.0-content-contentList-layout-contentRight-overview-dateRange-listViewDateRangeOptions","e":"change","c":"listViewDateRangeOptions13","ad":true,"m":"POST"});;

Is this a wicket bug?

I'm using Apache Wicket 6.9.1.

Thanks a lot.

Sergio

Re: Wicket - Apache URL rewrite Access-Control-Allow-Origin issue

Posted by Sergio Paganoni <se...@gmail.com>.
Hi Martin,

Thanks for the response, your workaround did the trick!

Thanks a lot, I'll wait to the official bug fix on version 7.0.0 and for
now stay with your workaround.

Bye


On Thu, Sep 26, 2013 at 11:34 AM, Martin Grigorov <mg...@apache.org>wrote:

> Hi,
>
>
> On Thu, Sep 26, 2013 at 11:22 AM, Sergio Paganoni <
> sergio.paganoni@gmail.com
> > wrote:
>
> > Hi Everybody,
> >
> > I'm facing a strange issue. I'm on UserPage on
> > http://account.dev.pippo.com/account/UserPage in this page I have a
> > DropDown component to filter a listview (using Ajax). When choosing a
> value
> > from the dropdown the XMLHttpRequest is done against
> > http://dev.pippo.cominstead of
> > http://account.dev.pippo.com/account. This leads to an
> > Access-Control-Allow-Origin problem:
> >
> > XMLHttpRequest cannot load
> > https://dev.pippo.com/wicket/page?3-1.IBehaviorListener.0-c
> >
> …ontentList-layout-contentRight-overview-dateRange-listViewDateRangeOptions.
> > Origin https://account.dev.pippo.com is not allowed by
> > Access-Control-Allow-Origin.
> >
> > I have an Apache rewrite rule that prepend the account. URL when /account
> > is used.
> >
> > The /account URL is mounted using:
> >
> > mountPackage("/account", UserPage.class);
> >
>
> Add : mountPage("/account/UserPage", UserPage.class);
> and check the produced markup. I'd expect to see something like:
>
>
> Wicket.Ajax.ajax({"u":"./?3-1.IBehaviorListener.0-content-contentList-layout-contentRight-overview-dateRange-listViewDateRangeOptions","e":"change","c":"listViewDateRangeOptions13","ad":true,"m":"POST"});;
>
> that is the url should not have "wicket/page" in front.
>
> If this fixes the problem then the issue is
> https://issues.apache.org/jira/browse/WICKET-5043
>
>
> > (I moved all panels and custom components used by this UserPage on the
> same
> > package)
> >
> > Should't wicket use the current URL (
> http://account.dev.pippo.com/account/
> > )
> > as target for the Ajax request (to avoid browser blocking the requests)?
> >
> > In the markup file I have the following AJAX request
> >
> >
> Wicket.Ajax.ajax({"u":"../wicket/page?3-1.IBehaviorListener.0-content-contentList-layout-contentRight-overview-dateRange-listViewDateRangeOptions","e":"change","c":"listViewDateRangeOptions13","ad":true,"m":"POST"});;
> >
> > Is this a wicket bug?
> >
> > I'm using Apache Wicket 6.9.1.
> >
> > Thanks a lot.
> >
> > Sergio
> >
>

Re: Wicket - Apache URL rewrite Access-Control-Allow-Origin issue

Posted by Martin Grigorov <mg...@apache.org>.
Hi,


On Thu, Sep 26, 2013 at 11:22 AM, Sergio Paganoni <sergio.paganoni@gmail.com
> wrote:

> Hi Everybody,
>
> I'm facing a strange issue. I'm on UserPage on
> http://account.dev.pippo.com/account/UserPage in this page I have a
> DropDown component to filter a listview (using Ajax). When choosing a value
> from the dropdown the XMLHttpRequest is done against
> http://dev.pippo.cominstead of
> http://account.dev.pippo.com/account. This leads to an
> Access-Control-Allow-Origin problem:
>
> XMLHttpRequest cannot load
> https://dev.pippo.com/wicket/page?3-1.IBehaviorListener.0-c
> …ontentList-layout-contentRight-overview-dateRange-listViewDateRangeOptions.
> Origin https://account.dev.pippo.com is not allowed by
> Access-Control-Allow-Origin.
>
> I have an Apache rewrite rule that prepend the account. URL when /account
> is used.
>
> The /account URL is mounted using:
>
> mountPackage("/account", UserPage.class);
>

Add : mountPage("/account/UserPage", UserPage.class);
and check the produced markup. I'd expect to see something like:

Wicket.Ajax.ajax({"u":"./?3-1.IBehaviorListener.0-content-contentList-layout-contentRight-overview-dateRange-listViewDateRangeOptions","e":"change","c":"listViewDateRangeOptions13","ad":true,"m":"POST"});;

that is the url should not have "wicket/page" in front.

If this fixes the problem then the issue is
https://issues.apache.org/jira/browse/WICKET-5043


> (I moved all panels and custom components used by this UserPage on the same
> package)
>
> Should't wicket use the current URL (http://account.dev.pippo.com/account/
> )
> as target for the Ajax request (to avoid browser blocking the requests)?
>
> In the markup file I have the following AJAX request
>
> Wicket.Ajax.ajax({"u":"../wicket/page?3-1.IBehaviorListener.0-content-contentList-layout-contentRight-overview-dateRange-listViewDateRangeOptions","e":"change","c":"listViewDateRangeOptions13","ad":true,"m":"POST"});;
>
> Is this a wicket bug?
>
> I'm using Apache Wicket 6.9.1.
>
> Thanks a lot.
>
> Sergio
>