You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by John <jo...@quivinco.com> on 2013/05/31 21:45:30 UTC

Tapestry links not https

My tapestry app doesn't work with SSL set up, the links have port 443 added but start http://.

There must be some configuration missing?

John

Re: Tapestry links not https

Posted by Ryan How <ry...@zbit.net.au>.
I haven't used the later versions of tapestry (I'm still back on 5.1 or 
5.2 or something).
By I replaced the BaseURLSource with my own version.
Just Note: This might not be what you want. It uses the requested port 
to determine what port to use on generating links.

Something like this:

package www.services;

import javax.servlet.http.HttpServletRequest;

import org.apache.tapestry5.services.BaseURLSource;
import org.apache.tapestry5.services.RequestGlobals;

public class MyBaseURLSource implements BaseURLSource {

     private HttpServletRequest request;
     private RequestGlobals requestGlobals;

     public MyBaseURLSource(RequestGlobals requestGlobals) {
         this.requestGlobals = requestGlobals;
     }

     public String getBaseURL(boolean secure) {

         request = requestGlobals.getHTTPServletRequest();
         String hostName = request.getServerName();
         int port = request.getServerPort();

         if (request.isSecure() == secure) {
             if (secure) return "https://" + hostName + (port == 443 ? 
"" : ":" + port);
             if (!secure) return "http://" + hostName + (port == 80 ? "" 
: ":" + port);
         }

         if (secure) return "https://" + hostName;
         return "http://" + hostName;
     }
}


Then override it in your AppModule

         binder.bind(BaseURLSource.class, 
MyBaseURLSource.class).withId("Override");


Thanks, Ryan


On 3/06/2013 7:16 PM, John wrote:
> Thanks for that, I guess these settings need to match the externally visible sockets?
>
> We are using NAT to reassign ports externally. But if we do that then the app won't work when accessed on the internal network?
>
> regards,
> John
>    ----- Original Message -----
>    From: Alejandro Scandroli
>    To: Tapestry users
>    Sent: Monday, June 03, 2013 10:52 AM
>    Subject: Re: Tapestry links not https
>
>
>    Hi John
>
>    These are configuration symbols: http://tapestry.apache.org/symbols.html
>    One way (there are other ways) you can configured them is through the
>    ApplicationDefaults provider
>
>    public static void
>    contributeApplicationDefaults(MappedConfiguration<String, Object>
>    configuration)
>    {
>    configuration.add(SymbolConstants.HOSTPORT, 8080);
>    configuration.add(SymbolConstants.HOSTPORT_SECURE, 8443);
>    }
>
>
>    Alejandro.
>
>
>
>
>
>    On Fri, May 31, 2013 at 11:44 PM, John <jo...@quivinco.com> wrote:
>    > Hi,
>    >
>    > Thanks for pointing out that problem.
>    >
>    > Should I set these ports to match my Jetty config, where should I set these values? Have you got a code snippet pls?
>    >
>    > John
>    >   ----- Original Message -----
>    >   From: Alejandro Scandroli
>    >   To: Tapestry users
>    >   Sent: Friday, May 31, 2013 9:29 PM
>    >   Subject: Re: Tapestry links not https
>    >
>    >
>    >   John, make sure you set both SymbolConstants.HOSTPORT and
>    >   SymbolConstants.HOSTPORT_SECURE.
>    >   There is a tiny issue with this if you don't do it, see my comments
>    >   here: https://issues.apache.org/jira/browse/TAP5-1973
>    >
>    >   Alejandro.
>    >
>    >   On Fri, May 31, 2013 at 10:20 PM, John <jo...@quivinco.com> wrote:
>    >   > Yes, I see that.
>    >   >
>    >   > I added the @Secure to some of my pages, they work fine now, but my pages without @Secure write http://hostname:443 which is screwed up. We only use port 443 externally, in Jetty it's 8443.
>    >   >
>    >   > I guess I need something like below to set the right ports, the server name is fine though so I don't need to set that.
>    >   >
>    >   > John
>    >   >   ----- Original Message -----
>    >   >   From: Dmitry Gusev
>    >   >   To: Tapestry users
>    >   >   Sent: Friday, May 31, 2013 9:01 PM
>    >   >   Subject: Re: Tapestry links not https
>    >   >
>    >   >
>    >   >   Sorry, looks like you've cited this page, but there's a code sample that
>    >   >   controls port numbers:
>    >   >
>    >   >
>    >   >     public static void
>    >   >   contributeServiceOverride(MappedConfiguration<Class,Object>
>    >   >   configuration)
>    >   >       {
>    >   >           BaseURLSource source = new BaseURLSource()
>    >   >           {
>    >   >               public String getBaseURL(boolean secure)
>    >   >               {
>    >   >                   String protocol = secure ? "https" : "http";
>    >   >
>    >   >                   int port = secure ? 8443 : 8080;
>    >   >
>    >   >                   return String.format("%s://localhost:%d", protocol,
>    >   >   port);            }
>    >   >           };
>    >   >
>    >   >           configuration.add(BaseURLSource.class, source);
>    >   >       }
>    >   >
>    >   >
>    >   >   On Fri, May 31, 2013 at 11:54 PM, Dmitry Gusev <dm...@gmail.com>wrote:
>    >   >
>    >   >   > Have you read this:
>    >   >   >
>    >   >   > http://tapestry.apache.org/https.html
>    >   >   >
>    >   >   >
>    >   >   > On Fri, May 31, 2013 at 11:50 PM, John <jo...@quivinco.com> wrote:
>    >   >   >
>    >   >   >> hmm, ok so I just read this...
>    >   >   >>
>    >   >   >> Links to non-secure pages from a secure page will do the reverse: a
>    >   >   >> complete URL with an "http" protocol will be used. In other words, Tapestry
>    >   >   >> manages the transition from insecure to secure and back again.
>    >   >   >>
>    >   >   >> So tapestry is writing the http:// that for non-secure pages, but is
>    >   >   >> unaware of the port number. I'd like to secure the whole site at
>    >   >   >> deployment, rather than have SSL running on my test box. Is there a way to
>    >   >   >> do that?
>    >   >   >>
>    >   >   >> It seems I must follow the Tapestry way of @Secure in the pages, but
>    >   >   >> that's not configurable.
>    >   >   >>
>    >   >   >> John
>    >   >   >>   ----- Original Message -----
>    >   >   >>   From: John
>    >   >   >>   To: users@tapestry.apache.org
>    >   >   >>   Sent: Friday, May 31, 2013 8:45 PM
>    >   >   >>   Subject: Tapestry links not https
>    >   >   >>
>    >   >   >>
>    >   >   >>   My tapestry app doesn't work with SSL set up, the links have port 443
>    >   >   >> added but start http://.
>    >   >   >>
>    >   >   >>   There must be some configuration missing?
>    >   >   >>
>    >   >   >>   John
>    >   >   >>
>    >   >   >
>    >   >   >
>    >   >   >
>    >   >   > --
>    >   >   > Dmitry Gusev
>    >   >   >
>    >   >   > AnjLab Team
>    >   >   > http://anjlab.com
>    >   >   >
>    >   >
>    >   >
>    >   >
>    >   >   --
>    >   >   Dmitry Gusev
>    >   >
>    >   >   AnjLab Team
>    >   >   http://anjlab.com
>    >
>    >   ---------------------------------------------------------------------
>    >   To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>    >   For additional commands, e-mail: users-help@tapestry.apache.org
>
>    ---------------------------------------------------------------------
>    To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>    For additional commands, e-mail: users-help@tapestry.apache.org
>



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: Tapestry links not https

Posted by Ryan How <ry...@zbit.net.au>.
Also regarding NAT. I generally try and use NAT reflection too when I do 
port mapping, so internal users still go through the port mapping on the 
router. It helps simplify things a bit. Only problem is to your app it 
appears that all the request come from the Router IP.

Another option is to use something like a Pound reverse proxy and pass 
everything through that.


On 3/06/2013 7:16 PM, John wrote:
> Thanks for that, I guess these settings need to match the externally visible sockets?
>
> We are using NAT to reassign ports externally. But if we do that then the app won't work when accessed on the internal network?
>
> regards,
> John
>    ----- Original Message -----
>    From: Alejandro Scandroli
>    To: Tapestry users
>    Sent: Monday, June 03, 2013 10:52 AM
>    Subject: Re: Tapestry links not https
>
>
>    Hi John
>
>    These are configuration symbols: http://tapestry.apache.org/symbols.html
>    One way (there are other ways) you can configured them is through the
>    ApplicationDefaults provider
>
>    public static void
>    contributeApplicationDefaults(MappedConfiguration<String, Object>
>    configuration)
>    {
>    configuration.add(SymbolConstants.HOSTPORT, 8080);
>    configuration.add(SymbolConstants.HOSTPORT_SECURE, 8443);
>    }
>
>
>    Alejandro.
>
>
>
>
>
>    On Fri, May 31, 2013 at 11:44 PM, John <jo...@quivinco.com> wrote:
>    > Hi,
>    >
>    > Thanks for pointing out that problem.
>    >
>    > Should I set these ports to match my Jetty config, where should I set these values? Have you got a code snippet pls?
>    >
>    > John
>    >   ----- Original Message -----
>    >   From: Alejandro Scandroli
>    >   To: Tapestry users
>    >   Sent: Friday, May 31, 2013 9:29 PM
>    >   Subject: Re: Tapestry links not https
>    >
>    >
>    >   John, make sure you set both SymbolConstants.HOSTPORT and
>    >   SymbolConstants.HOSTPORT_SECURE.
>    >   There is a tiny issue with this if you don't do it, see my comments
>    >   here: https://issues.apache.org/jira/browse/TAP5-1973
>    >
>    >   Alejandro.
>    >
>    >   On Fri, May 31, 2013 at 10:20 PM, John <jo...@quivinco.com> wrote:
>    >   > Yes, I see that.
>    >   >
>    >   > I added the @Secure to some of my pages, they work fine now, but my pages without @Secure write http://hostname:443 which is screwed up. We only use port 443 externally, in Jetty it's 8443.
>    >   >
>    >   > I guess I need something like below to set the right ports, the server name is fine though so I don't need to set that.
>    >   >
>    >   > John
>    >   >   ----- Original Message -----
>    >   >   From: Dmitry Gusev
>    >   >   To: Tapestry users
>    >   >   Sent: Friday, May 31, 2013 9:01 PM
>    >   >   Subject: Re: Tapestry links not https
>    >   >
>    >   >
>    >   >   Sorry, looks like you've cited this page, but there's a code sample that
>    >   >   controls port numbers:
>    >   >
>    >   >
>    >   >     public static void
>    >   >   contributeServiceOverride(MappedConfiguration<Class,Object>
>    >   >   configuration)
>    >   >       {
>    >   >           BaseURLSource source = new BaseURLSource()
>    >   >           {
>    >   >               public String getBaseURL(boolean secure)
>    >   >               {
>    >   >                   String protocol = secure ? "https" : "http";
>    >   >
>    >   >                   int port = secure ? 8443 : 8080;
>    >   >
>    >   >                   return String.format("%s://localhost:%d", protocol,
>    >   >   port);            }
>    >   >           };
>    >   >
>    >   >           configuration.add(BaseURLSource.class, source);
>    >   >       }
>    >   >
>    >   >
>    >   >   On Fri, May 31, 2013 at 11:54 PM, Dmitry Gusev <dm...@gmail.com>wrote:
>    >   >
>    >   >   > Have you read this:
>    >   >   >
>    >   >   > http://tapestry.apache.org/https.html
>    >   >   >
>    >   >   >
>    >   >   > On Fri, May 31, 2013 at 11:50 PM, John <jo...@quivinco.com> wrote:
>    >   >   >
>    >   >   >> hmm, ok so I just read this...
>    >   >   >>
>    >   >   >> Links to non-secure pages from a secure page will do the reverse: a
>    >   >   >> complete URL with an "http" protocol will be used. In other words, Tapestry
>    >   >   >> manages the transition from insecure to secure and back again.
>    >   >   >>
>    >   >   >> So tapestry is writing the http:// that for non-secure pages, but is
>    >   >   >> unaware of the port number. I'd like to secure the whole site at
>    >   >   >> deployment, rather than have SSL running on my test box. Is there a way to
>    >   >   >> do that?
>    >   >   >>
>    >   >   >> It seems I must follow the Tapestry way of @Secure in the pages, but
>    >   >   >> that's not configurable.
>    >   >   >>
>    >   >   >> John
>    >   >   >>   ----- Original Message -----
>    >   >   >>   From: John
>    >   >   >>   To: users@tapestry.apache.org
>    >   >   >>   Sent: Friday, May 31, 2013 8:45 PM
>    >   >   >>   Subject: Tapestry links not https
>    >   >   >>
>    >   >   >>
>    >   >   >>   My tapestry app doesn't work with SSL set up, the links have port 443
>    >   >   >> added but start http://.
>    >   >   >>
>    >   >   >>   There must be some configuration missing?
>    >   >   >>
>    >   >   >>   John
>    >   >   >>
>    >   >   >
>    >   >   >
>    >   >   >
>    >   >   > --
>    >   >   > Dmitry Gusev
>    >   >   >
>    >   >   > AnjLab Team
>    >   >   > http://anjlab.com
>    >   >   >
>    >   >
>    >   >
>    >   >
>    >   >   --
>    >   >   Dmitry Gusev
>    >   >
>    >   >   AnjLab Team
>    >   >   http://anjlab.com
>    >
>    >   ---------------------------------------------------------------------
>    >   To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>    >   For additional commands, e-mail: users-help@tapestry.apache.org
>
>    ---------------------------------------------------------------------
>    To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>    For additional commands, e-mail: users-help@tapestry.apache.org
>



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: Tapestry links not https

Posted by John <jo...@quivinco.com>.
Thanks for that, I guess these settings need to match the externally visible sockets?

We are using NAT to reassign ports externally. But if we do that then the app won't work when accessed on the internal network?

regards,
John
  ----- Original Message ----- 
  From: Alejandro Scandroli 
  To: Tapestry users 
  Sent: Monday, June 03, 2013 10:52 AM
  Subject: Re: Tapestry links not https


  Hi John

  These are configuration symbols: http://tapestry.apache.org/symbols.html
  One way (there are other ways) you can configured them is through the
  ApplicationDefaults provider

  public static void
  contributeApplicationDefaults(MappedConfiguration<String, Object>
  configuration)
  {
  configuration.add(SymbolConstants.HOSTPORT, 8080);
  configuration.add(SymbolConstants.HOSTPORT_SECURE, 8443);
  }


  Alejandro.





  On Fri, May 31, 2013 at 11:44 PM, John <jo...@quivinco.com> wrote:
  > Hi,
  >
  > Thanks for pointing out that problem.
  >
  > Should I set these ports to match my Jetty config, where should I set these values? Have you got a code snippet pls?
  >
  > John
  >   ----- Original Message -----
  >   From: Alejandro Scandroli
  >   To: Tapestry users
  >   Sent: Friday, May 31, 2013 9:29 PM
  >   Subject: Re: Tapestry links not https
  >
  >
  >   John, make sure you set both SymbolConstants.HOSTPORT and
  >   SymbolConstants.HOSTPORT_SECURE.
  >   There is a tiny issue with this if you don't do it, see my comments
  >   here: https://issues.apache.org/jira/browse/TAP5-1973
  >
  >   Alejandro.
  >
  >   On Fri, May 31, 2013 at 10:20 PM, John <jo...@quivinco.com> wrote:
  >   > Yes, I see that.
  >   >
  >   > I added the @Secure to some of my pages, they work fine now, but my pages without @Secure write http://hostname:443 which is screwed up. We only use port 443 externally, in Jetty it's 8443.
  >   >
  >   > I guess I need something like below to set the right ports, the server name is fine though so I don't need to set that.
  >   >
  >   > John
  >   >   ----- Original Message -----
  >   >   From: Dmitry Gusev
  >   >   To: Tapestry users
  >   >   Sent: Friday, May 31, 2013 9:01 PM
  >   >   Subject: Re: Tapestry links not https
  >   >
  >   >
  >   >   Sorry, looks like you've cited this page, but there's a code sample that
  >   >   controls port numbers:
  >   >
  >   >
  >   >     public static void
  >   >   contributeServiceOverride(MappedConfiguration<Class,Object>
  >   >   configuration)
  >   >       {
  >   >           BaseURLSource source = new BaseURLSource()
  >   >           {
  >   >               public String getBaseURL(boolean secure)
  >   >               {
  >   >                   String protocol = secure ? "https" : "http";
  >   >
  >   >                   int port = secure ? 8443 : 8080;
  >   >
  >   >                   return String.format("%s://localhost:%d", protocol,
  >   >   port);            }
  >   >           };
  >   >
  >   >           configuration.add(BaseURLSource.class, source);
  >   >       }
  >   >
  >   >
  >   >   On Fri, May 31, 2013 at 11:54 PM, Dmitry Gusev <dm...@gmail.com>wrote:
  >   >
  >   >   > Have you read this:
  >   >   >
  >   >   > http://tapestry.apache.org/https.html
  >   >   >
  >   >   >
  >   >   > On Fri, May 31, 2013 at 11:50 PM, John <jo...@quivinco.com> wrote:
  >   >   >
  >   >   >> hmm, ok so I just read this...
  >   >   >>
  >   >   >> Links to non-secure pages from a secure page will do the reverse: a
  >   >   >> complete URL with an "http" protocol will be used. In other words, Tapestry
  >   >   >> manages the transition from insecure to secure and back again.
  >   >   >>
  >   >   >> So tapestry is writing the http:// that for non-secure pages, but is
  >   >   >> unaware of the port number. I'd like to secure the whole site at
  >   >   >> deployment, rather than have SSL running on my test box. Is there a way to
  >   >   >> do that?
  >   >   >>
  >   >   >> It seems I must follow the Tapestry way of @Secure in the pages, but
  >   >   >> that's not configurable.
  >   >   >>
  >   >   >> John
  >   >   >>   ----- Original Message -----
  >   >   >>   From: John
  >   >   >>   To: users@tapestry.apache.org
  >   >   >>   Sent: Friday, May 31, 2013 8:45 PM
  >   >   >>   Subject: Tapestry links not https
  >   >   >>
  >   >   >>
  >   >   >>   My tapestry app doesn't work with SSL set up, the links have port 443
  >   >   >> added but start http://.
  >   >   >>
  >   >   >>   There must be some configuration missing?
  >   >   >>
  >   >   >>   John
  >   >   >>
  >   >   >
  >   >   >
  >   >   >
  >   >   > --
  >   >   > Dmitry Gusev
  >   >   >
  >   >   > AnjLab Team
  >   >   > http://anjlab.com
  >   >   >
  >   >
  >   >
  >   >
  >   >   --
  >   >   Dmitry Gusev
  >   >
  >   >   AnjLab Team
  >   >   http://anjlab.com
  >
  >   ---------------------------------------------------------------------
  >   To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
  >   For additional commands, e-mail: users-help@tapestry.apache.org

  ---------------------------------------------------------------------
  To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
  For additional commands, e-mail: users-help@tapestry.apache.org

Re: Tapestry links not https

Posted by Alejandro Scandroli <al...@gmail.com>.
Hi John

These are configuration symbols: http://tapestry.apache.org/symbols.html
One way (there are other ways) you can configured them is through the
ApplicationDefaults provider

public static void
contributeApplicationDefaults(MappedConfiguration<String, Object>
configuration)
{
configuration.add(SymbolConstants.HOSTPORT, 8080);
configuration.add(SymbolConstants.HOSTPORT_SECURE, 8443);
}


Alejandro.





On Fri, May 31, 2013 at 11:44 PM, John <jo...@quivinco.com> wrote:
> Hi,
>
> Thanks for pointing out that problem.
>
> Should I set these ports to match my Jetty config, where should I set these values? Have you got a code snippet pls?
>
> John
>   ----- Original Message -----
>   From: Alejandro Scandroli
>   To: Tapestry users
>   Sent: Friday, May 31, 2013 9:29 PM
>   Subject: Re: Tapestry links not https
>
>
>   John, make sure you set both SymbolConstants.HOSTPORT and
>   SymbolConstants.HOSTPORT_SECURE.
>   There is a tiny issue with this if you don't do it, see my comments
>   here: https://issues.apache.org/jira/browse/TAP5-1973
>
>   Alejandro.
>
>   On Fri, May 31, 2013 at 10:20 PM, John <jo...@quivinco.com> wrote:
>   > Yes, I see that.
>   >
>   > I added the @Secure to some of my pages, they work fine now, but my pages without @Secure write http://hostname:443 which is screwed up. We only use port 443 externally, in Jetty it's 8443.
>   >
>   > I guess I need something like below to set the right ports, the server name is fine though so I don't need to set that.
>   >
>   > John
>   >   ----- Original Message -----
>   >   From: Dmitry Gusev
>   >   To: Tapestry users
>   >   Sent: Friday, May 31, 2013 9:01 PM
>   >   Subject: Re: Tapestry links not https
>   >
>   >
>   >   Sorry, looks like you've cited this page, but there's a code sample that
>   >   controls port numbers:
>   >
>   >
>   >     public static void
>   >   contributeServiceOverride(MappedConfiguration<Class,Object>
>   >   configuration)
>   >       {
>   >           BaseURLSource source = new BaseURLSource()
>   >           {
>   >               public String getBaseURL(boolean secure)
>   >               {
>   >                   String protocol = secure ? "https" : "http";
>   >
>   >                   int port = secure ? 8443 : 8080;
>   >
>   >                   return String.format("%s://localhost:%d", protocol,
>   >   port);            }
>   >           };
>   >
>   >           configuration.add(BaseURLSource.class, source);
>   >       }
>   >
>   >
>   >   On Fri, May 31, 2013 at 11:54 PM, Dmitry Gusev <dm...@gmail.com>wrote:
>   >
>   >   > Have you read this:
>   >   >
>   >   > http://tapestry.apache.org/https.html
>   >   >
>   >   >
>   >   > On Fri, May 31, 2013 at 11:50 PM, John <jo...@quivinco.com> wrote:
>   >   >
>   >   >> hmm, ok so I just read this...
>   >   >>
>   >   >> Links to non-secure pages from a secure page will do the reverse: a
>   >   >> complete URL with an "http" protocol will be used. In other words, Tapestry
>   >   >> manages the transition from insecure to secure and back again.
>   >   >>
>   >   >> So tapestry is writing the http:// that for non-secure pages, but is
>   >   >> unaware of the port number. I'd like to secure the whole site at
>   >   >> deployment, rather than have SSL running on my test box. Is there a way to
>   >   >> do that?
>   >   >>
>   >   >> It seems I must follow the Tapestry way of @Secure in the pages, but
>   >   >> that's not configurable.
>   >   >>
>   >   >> John
>   >   >>   ----- Original Message -----
>   >   >>   From: John
>   >   >>   To: users@tapestry.apache.org
>   >   >>   Sent: Friday, May 31, 2013 8:45 PM
>   >   >>   Subject: Tapestry links not https
>   >   >>
>   >   >>
>   >   >>   My tapestry app doesn't work with SSL set up, the links have port 443
>   >   >> added but start http://.
>   >   >>
>   >   >>   There must be some configuration missing?
>   >   >>
>   >   >>   John
>   >   >>
>   >   >
>   >   >
>   >   >
>   >   > --
>   >   > Dmitry Gusev
>   >   >
>   >   > AnjLab Team
>   >   > http://anjlab.com
>   >   >
>   >
>   >
>   >
>   >   --
>   >   Dmitry Gusev
>   >
>   >   AnjLab Team
>   >   http://anjlab.com
>
>   ---------------------------------------------------------------------
>   To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>   For additional commands, e-mail: users-help@tapestry.apache.org

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: Tapestry links not https

Posted by John <jo...@quivinco.com>.
Hi,

Thanks for pointing out that problem.

Should I set these ports to match my Jetty config, where should I set these values? Have you got a code snippet pls?
 
John
  ----- Original Message ----- 
  From: Alejandro Scandroli 
  To: Tapestry users 
  Sent: Friday, May 31, 2013 9:29 PM
  Subject: Re: Tapestry links not https


  John, make sure you set both SymbolConstants.HOSTPORT and
  SymbolConstants.HOSTPORT_SECURE.
  There is a tiny issue with this if you don't do it, see my comments
  here: https://issues.apache.org/jira/browse/TAP5-1973

  Alejandro.

  On Fri, May 31, 2013 at 10:20 PM, John <jo...@quivinco.com> wrote:
  > Yes, I see that.
  >
  > I added the @Secure to some of my pages, they work fine now, but my pages without @Secure write http://hostname:443 which is screwed up. We only use port 443 externally, in Jetty it's 8443.
  >
  > I guess I need something like below to set the right ports, the server name is fine though so I don't need to set that.
  >
  > John
  >   ----- Original Message -----
  >   From: Dmitry Gusev
  >   To: Tapestry users
  >   Sent: Friday, May 31, 2013 9:01 PM
  >   Subject: Re: Tapestry links not https
  >
  >
  >   Sorry, looks like you've cited this page, but there's a code sample that
  >   controls port numbers:
  >
  >
  >     public static void
  >   contributeServiceOverride(MappedConfiguration<Class,Object>
  >   configuration)
  >       {
  >           BaseURLSource source = new BaseURLSource()
  >           {
  >               public String getBaseURL(boolean secure)
  >               {
  >                   String protocol = secure ? "https" : "http";
  >
  >                   int port = secure ? 8443 : 8080;
  >
  >                   return String.format("%s://localhost:%d", protocol,
  >   port);            }
  >           };
  >
  >           configuration.add(BaseURLSource.class, source);
  >       }
  >
  >
  >   On Fri, May 31, 2013 at 11:54 PM, Dmitry Gusev <dm...@gmail.com>wrote:
  >
  >   > Have you read this:
  >   >
  >   > http://tapestry.apache.org/https.html
  >   >
  >   >
  >   > On Fri, May 31, 2013 at 11:50 PM, John <jo...@quivinco.com> wrote:
  >   >
  >   >> hmm, ok so I just read this...
  >   >>
  >   >> Links to non-secure pages from a secure page will do the reverse: a
  >   >> complete URL with an "http" protocol will be used. In other words, Tapestry
  >   >> manages the transition from insecure to secure and back again.
  >   >>
  >   >> So tapestry is writing the http:// that for non-secure pages, but is
  >   >> unaware of the port number. I'd like to secure the whole site at
  >   >> deployment, rather than have SSL running on my test box. Is there a way to
  >   >> do that?
  >   >>
  >   >> It seems I must follow the Tapestry way of @Secure in the pages, but
  >   >> that's not configurable.
  >   >>
  >   >> John
  >   >>   ----- Original Message -----
  >   >>   From: John
  >   >>   To: users@tapestry.apache.org
  >   >>   Sent: Friday, May 31, 2013 8:45 PM
  >   >>   Subject: Tapestry links not https
  >   >>
  >   >>
  >   >>   My tapestry app doesn't work with SSL set up, the links have port 443
  >   >> added but start http://.
  >   >>
  >   >>   There must be some configuration missing?
  >   >>
  >   >>   John
  >   >>
  >   >
  >   >
  >   >
  >   > --
  >   > Dmitry Gusev
  >   >
  >   > AnjLab Team
  >   > http://anjlab.com
  >   >
  >
  >
  >
  >   --
  >   Dmitry Gusev
  >
  >   AnjLab Team
  >   http://anjlab.com

  ---------------------------------------------------------------------
  To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
  For additional commands, e-mail: users-help@tapestry.apache.org

Re: Tapestry links not https

Posted by Alejandro Scandroli <al...@gmail.com>.
John, make sure you set both SymbolConstants.HOSTPORT and
SymbolConstants.HOSTPORT_SECURE.
There is a tiny issue with this if you don't do it, see my comments
here: https://issues.apache.org/jira/browse/TAP5-1973

Alejandro.

On Fri, May 31, 2013 at 10:20 PM, John <jo...@quivinco.com> wrote:
> Yes, I see that.
>
> I added the @Secure to some of my pages, they work fine now, but my pages without @Secure write http://hostname:443 which is screwed up. We only use port 443 externally, in Jetty it's 8443.
>
> I guess I need something like below to set the right ports, the server name is fine though so I don't need to set that.
>
> John
>   ----- Original Message -----
>   From: Dmitry Gusev
>   To: Tapestry users
>   Sent: Friday, May 31, 2013 9:01 PM
>   Subject: Re: Tapestry links not https
>
>
>   Sorry, looks like you've cited this page, but there's a code sample that
>   controls port numbers:
>
>
>     public static void
>   contributeServiceOverride(MappedConfiguration<Class,Object>
>   configuration)
>       {
>           BaseURLSource source = new BaseURLSource()
>           {
>               public String getBaseURL(boolean secure)
>               {
>                   String protocol = secure ? "https" : "http";
>
>                   int port = secure ? 8443 : 8080;
>
>                   return String.format("%s://localhost:%d", protocol,
>   port);            }
>           };
>
>           configuration.add(BaseURLSource.class, source);
>       }
>
>
>   On Fri, May 31, 2013 at 11:54 PM, Dmitry Gusev <dm...@gmail.com>wrote:
>
>   > Have you read this:
>   >
>   > http://tapestry.apache.org/https.html
>   >
>   >
>   > On Fri, May 31, 2013 at 11:50 PM, John <jo...@quivinco.com> wrote:
>   >
>   >> hmm, ok so I just read this...
>   >>
>   >> Links to non-secure pages from a secure page will do the reverse: a
>   >> complete URL with an "http" protocol will be used. In other words, Tapestry
>   >> manages the transition from insecure to secure and back again.
>   >>
>   >> So tapestry is writing the http:// that for non-secure pages, but is
>   >> unaware of the port number. I'd like to secure the whole site at
>   >> deployment, rather than have SSL running on my test box. Is there a way to
>   >> do that?
>   >>
>   >> It seems I must follow the Tapestry way of @Secure in the pages, but
>   >> that's not configurable.
>   >>
>   >> John
>   >>   ----- Original Message -----
>   >>   From: John
>   >>   To: users@tapestry.apache.org
>   >>   Sent: Friday, May 31, 2013 8:45 PM
>   >>   Subject: Tapestry links not https
>   >>
>   >>
>   >>   My tapestry app doesn't work with SSL set up, the links have port 443
>   >> added but start http://.
>   >>
>   >>   There must be some configuration missing?
>   >>
>   >>   John
>   >>
>   >
>   >
>   >
>   > --
>   > Dmitry Gusev
>   >
>   > AnjLab Team
>   > http://anjlab.com
>   >
>
>
>
>   --
>   Dmitry Gusev
>
>   AnjLab Team
>   http://anjlab.com

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: Tapestry links not https

Posted by John <jo...@quivinco.com>.
Yes, I see that.

I added the @Secure to some of my pages, they work fine now, but my pages without @Secure write http://hostname:443 which is screwed up. We only use port 443 externally, in Jetty it's 8443.

I guess I need something like below to set the right ports, the server name is fine though so I don't need to set that.

John
  ----- Original Message ----- 
  From: Dmitry Gusev 
  To: Tapestry users 
  Sent: Friday, May 31, 2013 9:01 PM
  Subject: Re: Tapestry links not https


  Sorry, looks like you've cited this page, but there's a code sample that
  controls port numbers:


    public static void
  contributeServiceOverride(MappedConfiguration<Class,Object>
  configuration)
      {
          BaseURLSource source = new BaseURLSource()
          {
              public String getBaseURL(boolean secure)
              {
                  String protocol = secure ? "https" : "http";

                  int port = secure ? 8443 : 8080;

                  return String.format("%s://localhost:%d", protocol,
  port);            }
          };

          configuration.add(BaseURLSource.class, source);
      }


  On Fri, May 31, 2013 at 11:54 PM, Dmitry Gusev <dm...@gmail.com>wrote:

  > Have you read this:
  >
  > http://tapestry.apache.org/https.html
  >
  >
  > On Fri, May 31, 2013 at 11:50 PM, John <jo...@quivinco.com> wrote:
  >
  >> hmm, ok so I just read this...
  >>
  >> Links to non-secure pages from a secure page will do the reverse: a
  >> complete URL with an "http" protocol will be used. In other words, Tapestry
  >> manages the transition from insecure to secure and back again.
  >>
  >> So tapestry is writing the http:// that for non-secure pages, but is
  >> unaware of the port number. I'd like to secure the whole site at
  >> deployment, rather than have SSL running on my test box. Is there a way to
  >> do that?
  >>
  >> It seems I must follow the Tapestry way of @Secure in the pages, but
  >> that's not configurable.
  >>
  >> John
  >>   ----- Original Message -----
  >>   From: John
  >>   To: users@tapestry.apache.org
  >>   Sent: Friday, May 31, 2013 8:45 PM
  >>   Subject: Tapestry links not https
  >>
  >>
  >>   My tapestry app doesn't work with SSL set up, the links have port 443
  >> added but start http://.
  >>
  >>   There must be some configuration missing?
  >>
  >>   John
  >>
  >
  >
  >
  > --
  > Dmitry Gusev
  >
  > AnjLab Team
  > http://anjlab.com
  >



  -- 
  Dmitry Gusev

  AnjLab Team
  http://anjlab.com

Re: Tapestry links not https

Posted by Dmitry Gusev <dm...@gmail.com>.
Sorry, looks like you've cited this page, but there's a code sample that
controls port numbers:


  public static void
contributeServiceOverride(MappedConfiguration<Class,Object>
configuration)
    {
        BaseURLSource source = new BaseURLSource()
        {
            public String getBaseURL(boolean secure)
            {
                String protocol = secure ? "https" : "http";

                int port = secure ? 8443 : 8080;

                return String.format("%s://localhost:%d", protocol,
port);            }
        };

        configuration.add(BaseURLSource.class, source);
    }


On Fri, May 31, 2013 at 11:54 PM, Dmitry Gusev <dm...@gmail.com>wrote:

> Have you read this:
>
> http://tapestry.apache.org/https.html
>
>
> On Fri, May 31, 2013 at 11:50 PM, John <jo...@quivinco.com> wrote:
>
>> hmm, ok so I just read this...
>>
>> Links to non-secure pages from a secure page will do the reverse: a
>> complete URL with an "http" protocol will be used. In other words, Tapestry
>> manages the transition from insecure to secure and back again.
>>
>> So tapestry is writing the http:// that for non-secure pages, but is
>> unaware of the port number. I'd like to secure the whole site at
>> deployment, rather than have SSL running on my test box. Is there a way to
>> do that?
>>
>> It seems I must follow the Tapestry way of @Secure in the pages, but
>> that's not configurable.
>>
>> John
>>   ----- Original Message -----
>>   From: John
>>   To: users@tapestry.apache.org
>>   Sent: Friday, May 31, 2013 8:45 PM
>>   Subject: Tapestry links not https
>>
>>
>>   My tapestry app doesn't work with SSL set up, the links have port 443
>> added but start http://.
>>
>>   There must be some configuration missing?
>>
>>   John
>>
>
>
>
> --
> Dmitry Gusev
>
> AnjLab Team
> http://anjlab.com
>



-- 
Dmitry Gusev

AnjLab Team
http://anjlab.com

Re: Tapestry links not https

Posted by Dmitry Gusev <dm...@gmail.com>.
Have you read this:

http://tapestry.apache.org/https.html

On Fri, May 31, 2013 at 11:50 PM, John <jo...@quivinco.com> wrote:

> hmm, ok so I just read this...
>
> Links to non-secure pages from a secure page will do the reverse: a
> complete URL with an "http" protocol will be used. In other words, Tapestry
> manages the transition from insecure to secure and back again.
>
> So tapestry is writing the http:// that for non-secure pages, but is
> unaware of the port number. I'd like to secure the whole site at
> deployment, rather than have SSL running on my test box. Is there a way to
> do that?
>
> It seems I must follow the Tapestry way of @Secure in the pages, but
> that's not configurable.
>
> John
>   ----- Original Message -----
>   From: John
>   To: users@tapestry.apache.org
>   Sent: Friday, May 31, 2013 8:45 PM
>   Subject: Tapestry links not https
>
>
>   My tapestry app doesn't work with SSL set up, the links have port 443
> added but start http://.
>
>   There must be some configuration missing?
>
>   John
>



-- 
Dmitry Gusev

AnjLab Team
http://anjlab.com

Re: Tapestry links not https

Posted by John <jo...@quivinco.com>.
hmm, ok so I just read this...

Links to non-secure pages from a secure page will do the reverse: a complete URL with an "http" protocol will be used. In other words, Tapestry manages the transition from insecure to secure and back again.

So tapestry is writing the http:// that for non-secure pages, but is unaware of the port number. I'd like to secure the whole site at deployment, rather than have SSL running on my test box. Is there a way to do that?

It seems I must follow the Tapestry way of @Secure in the pages, but that's not configurable.

John
  ----- Original Message ----- 
  From: John 
  To: users@tapestry.apache.org 
  Sent: Friday, May 31, 2013 8:45 PM
  Subject: Tapestry links not https


  My tapestry app doesn't work with SSL set up, the links have port 443 added but start http://.

  There must be some configuration missing?

  John

Re: Tapestry links not https

Posted by Dmitry Gusev <dm...@gmail.com>.
Here's how I solve this problem with Tomcat and OpenShift:

I declare these Symbol values:

tapestry.hostname=<my-app>.rhcloud.com
tapestry.hostport=80
tapestry.hostport-secure=443
tapestry.secure-enabled=true

I put @Secure to my pages.

And I declare RemoteIpValve in my application context like this:

<?xml version="1.0" encoding="UTF-8"?>
<Context>
    <Loader delegate="true"/>

    <Valve className="org.apache.catalina.valves.RemoteIpValve"
protocolHeader="x-forwarded-proto" />

    <Resource name="jdbc/app-name" auth="Container"
type="javax.sql.DataSource"
        ...>
    </Resource>
</Context>

This tomcat instance is running on port 8080 and 8433 in the cloud.

On Tue, Jun 4, 2013 at 7:57 PM, Richard Frovarp <rf...@apache.org> wrote:

> On 05/31/2013 02:45 PM, John wrote:
>
>> My tapestry app doesn't work with SSL set up, the links have port 443
>> added but start http://.
>>
>> There must be some configuration missing?
>>
>> John
>>
>>
> You may also want to look at: MetaDatConstants.SECURE_PAGE. I know even
> with AJP proxying to Tomcat, we've ran into troubles. We just set that to
> true when in production, and that fixes our links.
>
>
> ------------------------------**------------------------------**---------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.**apache.org<us...@tapestry.apache.org>
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>


-- 
Dmitry Gusev

AnjLab Team
http://anjlab.com

Re: Tapestry links not https

Posted by Richard Frovarp <rf...@apache.org>.
On 05/31/2013 02:45 PM, John wrote:
> My tapestry app doesn't work with SSL set up, the links have port 443 added but start http://.
>
> There must be some configuration missing?
>
> John
>

You may also want to look at: MetaDatConstants.SECURE_PAGE. I know even 
with AJP proxying to Tomcat, we've ran into troubles. We just set that 
to true when in production, and that fixes our links.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org