Naomi's notebook

Naomi's notebook

self._sslobj.do_handshake() OSError: [Errno 0] Error

apache+flask+geventでアプリを公開しようとしているとき、proxypassで指定したアドレスにアクセスするとエラーが起こる (直接:8000にアクセスすると見られる)

Traceback (most recent call last):
  File "src/gevent/greenlet.py", line 854, in gevent._gevent_cgreenlet.Greenlet.run
  File "/home/Naomi/.linuxbrew/Cellar/python@3.8/3.8.5/lib/python3.8/site-packages/gevent/baseserver.py", line 34, in _handle_and_close_when_done
    return handle(*args_tuple)
  File "/home/Naomi/.linuxbrew/Cellar/python@3.8/3.8.5/lib/python3.8/site-packages/gevent/server.py", line 233, in wrap_socket_and_handle
    with _closing_socket(self.wrap_socket(client_socket, **self.ssl_args)) as ssl_socket:
  File "/home/Naomi/.linuxbrew/Cellar/python@3.8/3.8.5/lib/python3.8/site-packages/gevent/_ssl3.py", line 793, in wrap_socket
    return SSLSocket(sock=sock, keyfile=keyfile, certfile=certfile,
  File "/home/Naomi/.linuxbrew/Cellar/python@3.8/3.8.5/lib/python3.8/site-packages/gevent/_ssl3.py", line 311, in __init__
    raise x
  File "/home/Naomi/.linuxbrew/Cellar/python@3.8/3.8.5/lib/python3.8/site-packages/gevent/_ssl3.py", line 307, in __init__
    self.do_handshake()
  File "/home/Naomi/.linuxbrew/Cellar/python@3.8/3.8.5/lib/python3.8/site-packages/gevent/_ssl3.py", line 663, in do_handshake
    self._sslobj.do_handshake()
OSError: [Errno 0] Error

httpsサーバへリバースプロキシするするときはapacheの設定を変える必要があるらしい。 以下の4行(ProxyPass部分を除いて)を追加する。

ProxyRequests Off
SSLProxyEngine On
SSLProxyCheckPeerCN off
SSLProxyCheckPeerName off
ProxyPass /CovidGraph/ https://0.0.0.0:8000/
ProxyPass /LiHabit/ https://0.0.0.0:9292/

こうするとちゃんと動いた。