Re: SSL & Secure Component
Re: SSL & Secure Component
- Subject: Re: SSL & Secure Component
- From: Chuck Hill <email@hidden>
- Date: Fri, 22 Apr 2016 18:33:25 +0000
- Thread-topic: SSL & Secure Component
Probably you are getting different headers and/or Apache is not passing some of them through. Log out the request headers and see what is there. Also compare to the code in ERXRequest.isRequestSecure
Chuck
On 2016-04-22, 9:03 AM, "webobjects-dev-bounces+chill=email@hidden on behalf of Gino Pacitti" <webobjects-dev-bounces+chill=email@hidden on behalf of email@hidden> wrote:
>Hi List
>I have been using an implementation of this SecureComponent (see below) in a few apps but since I have now moved. The new set is:
>
>Centos 6.7 Container
>Apache 2.2.15 - SSL enabled etc.
>mod_webobjects.so adaptor 5.5 Adaptor from - http://wocommunity.org/documents/tools/mod_WebObjects/Apache2.2/centos/5.5/x86_64/
>
>It now seems to be doing something strange and will not return the secure page.
>
>Firstly port returns 0 and woserverport returns null. And then in my log it shows the request coming back quite a few times resulting in the page complaining about too many redirects and showing blank.
>
>Any ideas?
>
>
>
>public class SecureComponent extends WOComponent {
> protected boolean sslRequired;
>
> public boolean getSslRequired() {
> return sslRequired;
> }
> public void setSslRequired(boolean newSslRequired) {
> sslRequired = newSslRequired;
> }
> public void appendToResponse(WOResponse res, WOContext con) {
> String protocol = null;
> boolean switchRequired = false;
>
> super.appendToResponse(res, con);
> WORequest req = con.request();
> String port = req.headerForKey("SERVER_PORT");
> String woserverport = req.headerForKey("x-webobjects-server-port");
>
> if (sslRequired) {
> if ( port != null && !port.equals("443") ) {
> switchRequired = true;
> } else if ( woserverport != null && !woserverport.equals("443")
>) {
> switchRequired = true;
> } else {
> // unable to determine if switch is needed.
> switchRequired = false;
> }
> } else {
> if ( port != null && port.equals("443") ) {
> switchRequired = true;
> } else if ( woserverport != null && woserverport.equals("443") )
>{
> switchRequired = true;
> } else {
> // unable to determine if switch is needed.
> switchRequired = false;
> }
> }
>
> if (switchRequired) {
> if ( sslRequired) {
> protocol = "https://" ;
> } else {
> protocol = "http://" ;
> }
> String url =
>protocol+req.headerForKey("host")+con.componentActionURL();
> res.setHeader(url, "location");
> res.setHeader("text/html", "content-type");
> res.setHeader("0", "content-length");
> res.setStatus(302);
> }
> }
>}
>
>
> _______________________________________________
>Do not post admin requests to the list. They will be ignored.
>Webobjects-dev mailing list (email@hidden)
>Help/Unsubscribe/Update your Subscription:
>
>This email sent to email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden