librelist archives

« back to archive

HTTPS Support

HTTPS Support

From:
Joe Esposito
Date:
2011-03-09 @ 22:58
Does Flask have HTTPS support? How can I set it up such that
https://mysite/test points to the same resource as http://mysite/test?

Re: [flask] HTTPS Support

From:
Simon Sapin
Date:
2011-03-10 @ 00:13
Le 10/03/2011 07:58, Joe Esposito a écrit :
> Does Flask have HTTPS support? How can I set it up such that 
> https://mysite/test points to the same resource as http://mysite/test?
>

Hi,

HTTPS has nothing to do with Flask. Flask works with any WSGI server, 
and the one you choose may or may not support HTTPS. (But many do.)

What kind of platform do you want to deploy on?

Regards,
-- 
Simon Sapin
http://exyr.org

Re: [flask] HTTPS Support

From:
Joe Esposito
Date:
2011-03-10 @ 02:32
Ah, ok, I thought it had to be explicitly handled.
Especially since I call app.run(port=80) and I know that HTTPS is on port
443.

Linux mostly. (Dreamhost and Linode, to be precise.)
But also on Windows using IIS. I'm not yet sure if that project will require
HTTPS.

On Wed, Mar 9, 2011 at 7:13 PM, Simon Sapin <simon.sapin@exyr.org> wrote:

> Le 10/03/2011 07:58, Joe Esposito a écrit :
> > Does Flask have HTTPS support? How can I set it up such that
> > https://mysite/test points to the same resource as http://mysite/test?
> >
>
> Hi,
>
> HTTPS has nothing to do with Flask. Flask works with any WSGI server,
> and the one you choose may or may not support HTTPS. (But many do.)
>
> What kind of platform do you want to deploy on?
>
> Regards,
> --
> Simon Sapin
> http://exyr.org
>

Re: [flask] HTTPS Support

From:
Stephane Wirtel
Date:
2011-03-10 @ 08:38
The run method is used by the WSGI server (Werkzeug) to delivery a minimal
server for the developer.
For a production server, you can use uwsgi or gunicorn for the WSGI 
server, and nginx for the frontend.
or mod_wsgi with Apache,

The SSL layer will handled by the Web server (apache or nginx).

Regards,

Stéphane
On 03/10/2011 03:32 AM, Joe Esposito wrote:
> Ah, ok, I thought it had to be explicitly handled.
> Especially since I call app.run(port=80) and I know that HTTPS is on port 443.
> 
> Linux mostly. (Dreamhost and Linode, to be precise.)
> But also on Windows using IIS. I'm not yet sure if that project will 
require HTTPS.
> 
> On Wed, Mar 9, 2011 at 7:13 PM, Simon Sapin <simon.sapin@exyr.org 
<mailto:simon.sapin@exyr.org>> wrote:
> 
>     Le 10/03/2011 07:58, Joe Esposito a écrit :
>     > Does Flask have HTTPS support? How can I set it up such that
>     > https://mysite/test points to the same resource as http://mysite/test?
>     >
> 
>     Hi,
> 
>     HTTPS has nothing to do with Flask. Flask works with any WSGI server,
>     and the one you choose may or may not support HTTPS. (But many do.)
> 
>     What kind of platform do you want to deploy on?
> 
>     Regards,
>     --
>     Simon Sapin
>     http://exyr.org
> 
> 

Re: [flask] HTTPS Support

From:
Joe Esposito
Date:
2011-03-10 @ 20:03
> For a production server, you can use uwsgi or gunicorn for the WSGI
server, and nginx for the frontend.

Does that mean Flask is used strictly for the development side? I thought it
would just hook up to a server and work.

On Thu, Mar 10, 2011 at 3:38 AM, Stephane Wirtel <stephane@wirtel.be> wrote:

> The run method is used by the WSGI server (Werkzeug) to delivery a minimal
> server for the developer.
> For a production server, you can use uwsgi or gunicorn for the WSGI server,
> and nginx for the frontend.
> or mod_wsgi with Apache,
>
> The SSL layer will handled by the Web server (apache or nginx).
>
> Regards,
>
> Stéphane
> On 03/10/2011 03:32 AM, Joe Esposito wrote:
> > Ah, ok, I thought it had to be explicitly handled.
> > Especially since I call app.run(port=80) and I know that HTTPS is on port
> 443.
> >
> > Linux mostly. (Dreamhost and Linode, to be precise.)
> > But also on Windows using IIS. I'm not yet sure if that project will
> require HTTPS.
> >
> > On Wed, Mar 9, 2011 at 7:13 PM, Simon Sapin <simon.sapin@exyr.org<mailto:
> simon.sapin@exyr.org>> wrote:
> >
> >     Le 10/03/2011 07:58, Joe Esposito a écrit :
> >     > Does Flask have HTTPS support? How can I set it up such that
> >     > https://mysite/test points to the same resource as
> http://mysite/test?
> >     >
> >
> >     Hi,
> >
> >     HTTPS has nothing to do with Flask. Flask works with any WSGI server,
> >     and the one you choose may or may not support HTTPS. (But many do.)
> >
> >     What kind of platform do you want to deploy on?
> >
> >     Regards,
> >     --
> >     Simon Sapin
> >     http://exyr.org
> >
> >
>
>

Re: [flask] HTTPS Support

From:
JimG
Date:
2011-03-10 @ 10:53
HTTPS is not just running on port 443. There is a encryption layer in
between which is handled by the webserver and the browser. Typically you
would configure your webserver to serve SSL (note this will involve messing
around with SSL certificates). You app is then just a normal Flask app.

Note you may need to do some clever stuff with forwards and redirects which
can be tricky to reproduce in the development server, if you intend having a
"mixed" app, where certain items are SSL, and others are not.

Cheers, Jim.

On 10 March 2011 08:38, Stephane Wirtel <stephane@wirtel.be> wrote:

> The run method is used by the WSGI server (Werkzeug) to delivery a minimal
> server for the developer.
> For a production server, you can use uwsgi or gunicorn for the WSGI server,
> and nginx for the frontend.
> or mod_wsgi with Apache,
>
> The SSL layer will handled by the Web server (apache or nginx).
>
> Regards,
>
> Stéphane
> On 03/10/2011 03:32 AM, Joe Esposito wrote:
> > Ah, ok, I thought it had to be explicitly handled.
> > Especially since I call app.run(port=80) and I know that HTTPS is on port
> 443.
> >
> > Linux mostly. (Dreamhost and Linode, to be precise.)
> > But also on Windows using IIS. I'm not yet sure if that project will
> require HTTPS.
> >
> > On Wed, Mar 9, 2011 at 7:13 PM, Simon Sapin <simon.sapin@exyr.org<mailto:
> simon.sapin@exyr.org>> wrote:
> >
> >     Le 10/03/2011 07:58, Joe Esposito a écrit :
> >     > Does Flask have HTTPS support? How can I set it up such that
> >     > https://mysite/test points to the same resource as
> http://mysite/test?
> >     >
> >
> >     Hi,
> >
> >     HTTPS has nothing to do with Flask. Flask works with any WSGI server,
> >     and the one you choose may or may not support HTTPS. (But many do.)
> >
> >     What kind of platform do you want to deploy on?
> >
> >     Regards,
> >     --
> >     Simon Sapin
> >     http://exyr.org
> >
> >
>
>

Re: [flask] HTTPS Support

From:
Joe Esposito
Date:
2011-03-10 @ 20:05
Ah, ok. So it'd be easier to setup an SSL certificate and keep the entire
site on HTTPS? If anything, I'd like to have it to serve pages with HTTP and
require HTTPS when the user is logged in to the site. Would you need to
configure anything on Flask's end to do that?

On Thu, Mar 10, 2011 at 5:53 AM, JimG <j.gumbley@gmail.com> wrote:

> HTTPS is not just running on port 443. There is a encryption layer in
> between which is handled by the webserver and the browser. Typically you
> would configure your webserver to serve SSL (note this will involve messing
> around with SSL certificates). You app is then just a normal Flask app.
>
> Note you may need to do some clever stuff with forwards and redirects which
> can be tricky to reproduce in the development server, if you intend having a
> "mixed" app, where certain items are SSL, and others are not.
>
> Cheers, Jim.
>
> On 10 March 2011 08:38, Stephane Wirtel <stephane@wirtel.be> wrote:
>
>> The run method is used by the WSGI server (Werkzeug) to delivery a minimal
>> server for the developer.
>> For a production server, you can use uwsgi or gunicorn for the WSGI
>> server, and nginx for the frontend.
>> or mod_wsgi with Apache,
>>
>> The SSL layer will handled by the Web server (apache or nginx).
>>
>> Regards,
>>
>> Stéphane
>> On 03/10/2011 03:32 AM, Joe Esposito wrote:
>> > Ah, ok, I thought it had to be explicitly handled.
>> > Especially since I call app.run(port=80) and I know that HTTPS is on
>> port 443.
>> >
>> > Linux mostly. (Dreamhost and Linode, to be precise.)
>> > But also on Windows using IIS. I'm not yet sure if that project will
>> require HTTPS.
>> >
>> > On Wed, Mar 9, 2011 at 7:13 PM, Simon Sapin <simon.sapin@exyr.org<mailto:
>> simon.sapin@exyr.org>> wrote:
>> >
>> >     Le 10/03/2011 07:58, Joe Esposito a écrit :
>> >     > Does Flask have HTTPS support? How can I set it up such that
>> >     > https://mysite/test points to the same resource as
>> http://mysite/test?
>> >     >
>> >
>> >     Hi,
>> >
>> >     HTTPS has nothing to do with Flask. Flask works with any WSGI
>> server,
>> >     and the one you choose may or may not support HTTPS. (But many do.)
>> >
>> >     What kind of platform do you want to deploy on?
>> >
>> >     Regards,
>> >     --
>> >     Simon Sapin
>> >     http://exyr.org
>> >
>> >
>>
>>
>

Re: [flask] HTTPS Support

From:
Joe Esposito
Date:
2011-03-10 @ 20:25
I found some answers on this page:
http://flask.pocoo.org/docs/deploying/mod_wsgi/
Turns out you *don't *call app.run on the production server, which is not
what I thought. Hence the __name__ == '__main__' test.

<http://flask.pocoo.org/docs/deploying/mod_wsgi/>Thanks for your help.

On Thu, Mar 10, 2011 at 3:05 PM, Joe Esposito <espo58@gmail.com> wrote:

> Ah, ok. So it'd be easier to setup an SSL certificate and keep the entire
> site on HTTPS? If anything, I'd like to have it to serve pages with HTTP and
> require HTTPS when the user is logged in to the site. Would you need to
> configure anything on Flask's end to do that?
>
> On Thu, Mar 10, 2011 at 5:53 AM, JimG <j.gumbley@gmail.com> wrote:
>
>> HTTPS is not just running on port 443. There is a encryption layer in
>> between which is handled by the webserver and the browser. Typically you
>> would configure your webserver to serve SSL (note this will involve messing
>> around with SSL certificates). You app is then just a normal Flask app.
>>
>> Note you may need to do some clever stuff with forwards and redirects
>> which can be tricky to reproduce in the development server, if you intend
>> having a "mixed" app, where certain items are SSL, and others are not.
>>
>> Cheers, Jim.
>>
>> On 10 March 2011 08:38, Stephane Wirtel <stephane@wirtel.be> wrote:
>>
>>> The run method is used by the WSGI server (Werkzeug) to delivery a
>>> minimal server for the developer.
>>> For a production server, you can use uwsgi or gunicorn for the WSGI
>>> server, and nginx for the frontend.
>>> or mod_wsgi with Apache,
>>>
>>> The SSL layer will handled by the Web server (apache or nginx).
>>>
>>> Regards,
>>>
>>> Stéphane
>>> On 03/10/2011 03:32 AM, Joe Esposito wrote:
>>> > Ah, ok, I thought it had to be explicitly handled.
>>> > Especially since I call app.run(port=80) and I know that HTTPS is on
>>> port 443.
>>> >
>>> > Linux mostly. (Dreamhost and Linode, to be precise.)
>>> > But also on Windows using IIS. I'm not yet sure if that project will
>>> require HTTPS.
>>> >
>>> > On Wed, Mar 9, 2011 at 7:13 PM, Simon Sapin <simon.sapin@exyr.org<mailto:
>>> simon.sapin@exyr.org>> wrote:
>>> >
>>> >     Le 10/03/2011 07:58, Joe Esposito a écrit :
>>> >     > Does Flask have HTTPS support? How can I set it up such that
>>> >     > https://mysite/test points to the same resource as
>>> http://mysite/test?
>>> >     >
>>> >
>>> >     Hi,
>>> >
>>> >     HTTPS has nothing to do with Flask. Flask works with any WSGI
>>> server,
>>> >     and the one you choose may or may not support HTTPS. (But many do.)
>>> >
>>> >     What kind of platform do you want to deploy on?
>>> >
>>> >     Regards,
>>> >     --
>>> >     Simon Sapin
>>> >     http://exyr.org
>>> >
>>> >
>>>
>>>
>>
>