Giter Club home page Giter Club logo

Comments (9)

rmkraus avatar rmkraus commented on May 11, 2024

Modifying the server should be about as simple as this wrapping the HTTP
server's socket in an SSL socket
https://www.piware.de/2011/01/creating-an-https-server-in-python/. If
this works properly, then no other Python code will be required. Pretty
much a one liner in the http component. You may also want to update the log
output on line 175 too
https://github.com/balloob/home-assistant/blob/master/homeassistant/components/http.py#L175
.

I think you may even be able to get away without any modification of the
Javascript API.

Fingers crossed this is an easy one. It is definitely a necessary feature.

Thanks,

Ryan Kraus

On Sun, Jun 7, 2015 at 6:06 PM, stvnrlly [email protected] wrote:

I don't see an option to serve Home Assistant over HTTPS. My server
automatically redirects connections from HTTP to HTTPS, so this prevents me
from accessing the app.

If this isn't too complicated, I'm happy to give it a try and submit a
pull request, but I'll need some guidance about where to look.


Reply to this email directly or view it on GitHub
#171.

from core.

stvnrlly avatar stvnrlly commented on May 11, 2024

Well, it's entirely possible that I'm doing something incorrectly, but putting that one-liner in a few different locations always seems to get this error:

homeassistant.bootstrap: Error during setup of component http
Traceback (most recent call last):
  File "/usr/local/homeassistant/share/homeassistant/homeassistant/bootstrap.py", line 78, in _setup_component
    if component.setup(hass, config):
  File "/usr/local/homeassistant/share/homeassistant/homeassistant/components/http.py", line 131, in setup
    development, no_password_set)
  File "/usr/local/homeassistant/share/homeassistant/homeassistant/components/http.py", line 154, in __init__
    super().__init__(server_address, request_handler_class)
  File "/usr/local/python3/lib/python3.4/socketserver.py", line 429, in __init__
    self.server_bind()
  File "/usr/local/python3/lib/python3.4/http/server.py", line 133, in server_bind
    socketserver.TCPServer.server_bind(self)
  File "/usr/local/python3/lib/python3.4/socketserver.py", line 440, in server_bind
    self.socket.bind(self.server_address)
OSError: [Errno 98] Address already in use

from core.

rmkraus avatar rmkraus commented on May 11, 2024

It is equally as possible that you are not doing anything incorrectly and
the solution will be a bit more complicated. I have found that is usually
the case.

My intuition tells me the best place to perform this would be like 154,
right after the super call in the init function of the server class.

Also, in my first message, where I said, "Modifying the server should"...
Let's all just agree to pretend that I said, "Modifying the server could".

Thanks,

Ryan Kraus

On Mon, Jun 8, 2015 at 12:25 AM, stvnrlly [email protected] wrote:

Well, it's entirely possible that I'm doing something incorrectly, but
putting that one-liner in a few different locations always seems to get
this error:

homeassistant.bootstrap: Error during setup of component http
Traceback (most recent call last):
File "/usr/local/homeassistant/share/homeassistant/homeassistant/bootstrap.py", line 78, in _setup_component
if component.setup(hass, config):
File "/usr/local/homeassistant/share/homeassistant/homeassistant/components/http.py", line 131, in setup
development, no_password_set)
File "/usr/local/homeassistant/share/homeassistant/homeassistant/components/http.py", line 154, in init
super().init(server_address, request_handler_class)
File "/usr/local/python3/lib/python3.4/socketserver.py", line 429, in init
self.server_bind()
File "/usr/local/python3/lib/python3.4/http/server.py", line 133, in server_bind
socketserver.TCPServer.server_bind(self)
File "/usr/local/python3/lib/python3.4/socketserver.py", line 440, in server_bind
self.socket.bind(self.server_address)
OSError: [Errno 98] Address already in use


Reply to this email directly or view it on GitHub
#171 (comment)
.

from core.

balloob avatar balloob commented on May 11, 2024

Maybe not what you want, but wouldn't it be easier to offload SSL handling to a server like NGINX?

http://chase-seibert.github.io/blog/2011/12/21/nginx-ssl-reverse-proxy-tutorial.html:

If you have an existing HTTP application that you want to enable SSL for, nginx provides a convenient reverse proxy mode. In this mode, nginx is just responsible for providing SSL encryption; the actual HTTP content is still being served from your existing web server or load balancer.

from core.

stvnrlly avatar stvnrlly commented on May 11, 2024

Yeah, @balloob, that's probably what I'll do here. If there's anything you can do on your end to make it simpler, I'd encourage it, but if not feel free to close this issue.

from core.

balloob avatar balloob commented on May 11, 2024

Currently Home Assistant is using a home grown HTTP framework based on the built-in HTTP server. This was a good start because I have always wanted to keep dependencies low. But as functionality has grown over time it is inevitable that at one point we will have to migrate to a real framework (probably Flask). Till that day comes, I prefer not to make the current HTTP stack any more complex.

from core.

iBobik avatar iBobik commented on May 11, 2024

@balloob Is there open issue where we can track this topic? (Flask migration, HTTPS config)

from core.

rmkraus avatar rmkraus commented on May 11, 2024

HTTPS is now supported natively.
https://home-assistant.io/components/http/

I don't see anything on Pivotal Tracker about migrating to Flask. I don't think it is currently in work or planned.

from core.

iBobik avatar iBobik commented on May 11, 2024

Nice, thank you.

Jan Pobořil

2016-01-16 23:02 GMT+01:00 Ryan Kraus [email protected]:

HTTPS is now supported natively.
https://home-assistant.io/components/http/

I don't see anything on Pivotal Tracker about migrating to Flask. I don't
think it is currently in work.


Reply to this email directly or view it on GitHub
#171 (comment)
.

from core.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.