Re: Redirect based on a header?

2018-03-01 Thread Boris Goldowsky
Thank you both for sending me looking in useful directions.
In case it is useful to others, here is what I ended up implementing:

getRootRequestMapperAsCompound().add(
new IRequestMapper() {
public IRequestHandler mapRequest(Request request) {
if (request instanceof WebRequest) {
if ("http".equals(((WebRequest) 
request).getHeader("x-forwarded-proto")))
return new 
RedirectRequestHandler(HTTPS_URL, 301);
}
return null;
}

public int getCompatibilityScore(Request request) {
return 1;
}

public Url mapHandler(IRequestHandler requestHandler) {
return null;
}
});



Boris


On 2/23/18, 10:56 AM, "Andrea Del Bene"  wrote:

You might also find useful having a look at request cycle listener 
(class AbstractRequestCycleListener) which can be adopted to redirect 
the requests to https.


On 22/02/2018 23:35, Martin Grigorov wrote:
> Hi,
>
> Does it have to be "with Wicket" ?
> You can use custom Servlet Filter that is executed before WicketFilter.
>
> Martin Grigorov
> Wicket Training and Consulting
> Looking for a remote position with Wicket ? Contact me!
> https://twitter.com/mtgrigorov
>
>
> On Thu, Feb 22, 2018 at 5:55 PM, Boris Goldowsky 
> wrote:
>
>> I’m not sure if there is a wicket-y way to do this.
>>
>> In the environment where I’m deploying my wicket app (google cloud +
>> kubernetes + docker + tomcat), a request that came in to the load 
balancer
>> under insecure http is forwarded to wicket, and identified by the request
>> containing an “x-forwarded-proto” header with the value “http”.  I need 
to
>> redirect such requests to the https version of the site.
>>
>> Is there a way in wicket to look at a request header and send a redirect
>> before any of the usual URL processing happens?
>>
>> Thanks!
>> Boris
>>
>>
>>
>> -
>> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
>> For additional commands, e-mail: users-h...@wicket.apache.org
>>
>>


-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org





Re: Redirect based on a header?

2018-02-23 Thread Andrea Del Bene
You might also find useful having a look at request cycle listener 
(class AbstractRequestCycleListener) which can be adopted to redirect 
the requests to https.



On 22/02/2018 23:35, Martin Grigorov wrote:

Hi,

Does it have to be "with Wicket" ?
You can use custom Servlet Filter that is executed before WicketFilter.

Martin Grigorov
Wicket Training and Consulting
Looking for a remote position with Wicket ? Contact me!
https://twitter.com/mtgrigorov


On Thu, Feb 22, 2018 at 5:55 PM, Boris Goldowsky 
wrote:


I’m not sure if there is a wicket-y way to do this.

In the environment where I’m deploying my wicket app (google cloud +
kubernetes + docker + tomcat), a request that came in to the load balancer
under insecure http is forwarded to wicket, and identified by the request
containing an “x-forwarded-proto” header with the value “http”.  I need to
redirect such requests to the https version of the site.

Is there a way in wicket to look at a request header and send a redirect
before any of the usual URL processing happens?

Thanks!
Boris



-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org





-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: Redirect based on a header?

2018-02-22 Thread Martin Grigorov
Hi,

Does it have to be "with Wicket" ?
You can use custom Servlet Filter that is executed before WicketFilter.

Martin Grigorov
Wicket Training and Consulting
Looking for a remote position with Wicket ? Contact me!
https://twitter.com/mtgrigorov


On Thu, Feb 22, 2018 at 5:55 PM, Boris Goldowsky 
wrote:

> I’m not sure if there is a wicket-y way to do this.
>
> In the environment where I’m deploying my wicket app (google cloud +
> kubernetes + docker + tomcat), a request that came in to the load balancer
> under insecure http is forwarded to wicket, and identified by the request
> containing an “x-forwarded-proto” header with the value “http”.  I need to
> redirect such requests to the https version of the site.
>
> Is there a way in wicket to look at a request header and send a redirect
> before any of the usual URL processing happens?
>
> Thanks!
> Boris
>
>
>
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>


Redirect based on a header?

2018-02-22 Thread Boris Goldowsky
I’m not sure if there is a wicket-y way to do this.

In the environment where I’m deploying my wicket app (google cloud + kubernetes 
+ docker + tomcat), a request that came in to the load balancer under insecure 
http is forwarded to wicket, and identified by the request containing an 
“x-forwarded-proto” header with the value “http”.  I need to redirect such 
requests to the https version of the site.

Is there a way in wicket to look at a request header and send a redirect before 
any of the usual URL processing happens?

Thanks!
Boris



-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org