SSL Redirect not working

14 views
Skip to first unread message

Peter Baumgartner

unread,
Nov 28, 2007, 1:54:15 PM11/28/07
to satchm...@googlegroups.com
I'm using Satchmo 0.6 with some minor modifications and the SSL
redirect is not working for me.

satchmo.shop.SSLMiddleware.SSLRedirect is my last entry in MIDDLEWARE_CLASSES
I have 'Enable SSL' set in my Shop Options.

I'm using Nginx as a frontend to Apache/mod_python and I can manually
get to SSL pages fine.

Any thoughts on where to start digging?

--
Pete

Mike Hostetler

unread,
Nov 28, 2007, 2:56:39 PM11/28/07
to satchm...@googlegroups.com
I have this exact problem but I don't know how to fix it. So I made the "checkout" link to go directly to "https://..." instead of "http://..."

Sorry I can't be more help . . .

Cliff Wells

unread,
Nov 28, 2007, 3:21:43 PM11/28/07
to satchm...@googlegroups.com

Have you considered just having Nginx do the redirect?

As an aside, you can do away with Apache altogether by using CherryPy's
wsgiserver and proxying to it from Nginx.

Cliff

Chris Moffitt

unread,
Nov 28, 2007, 3:25:54 PM11/28/07
to satchm...@googlegroups.com
I'm assuming that you also have the SSL box for the specific payment module you're using.

You could try to put some debugging in the context processor to see if it is getting called correctly and returning the required url.

Obviously other folks have seen the problem so any help you can provide in troubleshooting would be helpful.

-Chris

Peter Baumgartner

unread,
Nov 28, 2007, 5:01:40 PM11/28/07
to satchm...@googlegroups.com
On Nov 28, 2007 1:25 PM, Chris Moffitt <ch...@moffitts.net> wrote:
> I'm assuming that you also have the SSL box for the specific payment module
> you're using.

yes.


>
> You could try to put some debugging in the context processor to see if it is
> getting called correctly and returning the required url.

What's the best way to do that w/ mod_python since prints won't work?

Chris Moffitt

unread,
Nov 28, 2007, 5:07:01 PM11/28/07
to satchm...@googlegroups.com
Try using the logging framework.

For example, see how it's used in this view -
http://www.satchmoproject.com/trac/browser/satchmo/trunk/satchmo/payment/modules/google/views.py

On 11/28/07, Peter Baumgartner <sgt....@gmail.com> wrote:

Peter Baumgartner

unread,
Nov 28, 2007, 5:21:24 PM11/28/07
to satchm...@googlegroups.com
>
> What's the best way to do that w/ mod_python since prints won't work?
>
answering my own question, assert False

Here's the result:

secure False
self <satchmo.shop.SSLMiddleware.SSLRedirect instance at 0x2c4f098>
view_args ()
view_func <function _checklogin at 0x45e05f0>
view_kwargs {}


Notice secure=False and view_kwargs is empty with both boxes in my
shop options for SSL checked. Any thoughts?

Peter Baumgartner

unread,
Nov 28, 2007, 5:45:50 PM11/28/07
to satchm...@googlegroups.com
>
> Obviously other folks have seen the problem so any help you can provide in
> troubleshooting would be helpful.
>

I think I know the problem. Nginx handles all the requests, then
proxies Django stuff to Apache. Apache isn't setup to do SSL. It looks
like the middleware is trying to redirect my internal Apache URL to
SSL instead of the outward facing URL with Nginx.

I'll probably just setup Nginx to redirect unless anybody has a better
suggestion.

--
Pete

Peter Baumgartner

unread,
Nov 28, 2007, 6:05:55 PM11/28/07
to satchm...@googlegroups.com
>
> I'll probably just setup Nginx to redirect unless anybody has a better
> suggestion.
>

For anybody else who runs into this, here's what that nginx config
would look like:

location ~ ^/shop/checkout {
rewrite ^/(.*) https://mydomain.com/$1 permanent;
}

Reply all
Reply to author
Forward
0 new messages