Right now with SSLMiddleware, if we are redirected to a non secure page, the code assume that we want to strip :433 to use default :80. If we are using a custom SSLPORT, we will be redirected to the SSLPORT.
In development, this cause problem because we aren't using the default 80 port and we surely don't want to use the SSLPORT for non-ssl page.
Here is a modified version (patch) of the SSLMiddleware.py, it check if a SERVER_PORT is set in the settings.py. If so, the redirect will use that port for non-secure page.
If the SERVERPORT isn't set, the code will behave as before.