10

Has anyone cracked how to get HTTPS working on the dev_appserver.py? I need it for Facebook canvas app testing. I've had a search of the docs and nothing suggests there's a way to do it (sticking 'secure' in the app.yaml doesn't nothing locally).

I was think there may be a way to proxy it, but has anyone got any experience of this?

Ahmed Nuaman
  • 12,662
  • 15
  • 55
  • 87

3 Answers3

7

The dev_appserver doesn't support HTTPS. The only practical way to do this is to set up a reverse proxy in front of your app - such as with nginx or Apache - and have it proxy SSL traffic to your app.

Nick Johnson
  • 100,655
  • 16
  • 128
  • 198
1

I know this is late, in case anybody else finds this question:

ngrok is quiet easy to setup for a custom reverse HTTPS proxy..

The only downside is that my webapp2 application still believes it's being served over HTTP, so using redirect() doesn't work well because it resolves relative URLs to absolute URLs using request.url.

My workaround was to overwrite RequestHandler.redirect as follows:

class BaseRequestHandler(RequestHandler):
  def redirect(self, uri, permanent = False, abort = False, code = None, body = None):
    if uri.startswith(('.', '/')):
      base_url = self.request.url
      if base_url.startswith('http://'):
        base_url = 'https://' + base_url[7:]
      uri = str(urlparse.urljoin(base_url, uri))
    super(RequestHandler, self).redirect(uri, permanent, abort, code, body)

I needed a BaseRequestHandler class anyways for implementing other utility functions.

jonasfj
  • 2,349
  • 2
  • 24
  • 22
0

I put this in my Appache httpd.conf to proxy the connection:

<Location /myproject/>
    ProxyPass http://localhost:8080/
</Location>

Now going to https://localhost/myproject/ in my browser worked.

Note: SSL needs to be enabled on your Apache server. On my OS X machine I uncommented out the line Include /private/etc/apache2/extra/httpd-ssl.conf in /etc/apache2/httpd.conf and ran sudo apachectl restart

Zectbumo
  • 4,128
  • 1
  • 31
  • 26