# Webscoket errors while proxying through HTTPS with apache2

**URL:** <https://discuss.streamlit.io/t/webscoket-errors-while-proxying-through-https-with-apache2/30180>\
**Category:** Deployment\
**Tags:** apache\
**Created:** [September 2, 2022, 8:36pm UTC](https://discuss.streamlit.io/t/webscoket-errors-while-proxying-through-https-with-apache2/30180 "2022-09-02T20:36:03Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mar0dev](https://sea2.discourse-cdn.com/streamlit/user_avatar/discuss.streamlit.io/mar0dev/32/18242_2.png) [@Mar0dev](https://discuss.streamlit.io/u/Mar0dev)\
**Post date:** [September 2, 2022, 8:36pm UTC](https://discuss.streamlit.io/t/webscoket-errors-while-proxying-through-https-with-apache2/30180/1 "2022-09-02T20:36:03Z")

</div>

Hello everyone!

I’m trying to deploy streamlit app on my VPS. Server thst’s in use is Apache2 with SSL certificates generated by certbot.

Streamlit app works well on [http://localhost:8501/](http://localhost:8501/), as I want to make it public and safe with HTTPS, I’m using apache2 proxy. The configuration is as follows:

```auto
<IfModule mod_ssl.c>
<VirtualHost *:443>
    ServerName my.server-name.com
    #RewriteCond %{SERVER_NAME} =my.server-name.com

    RewriteEngine On
    RewriteCond %{HTTP:Upgrade} =websocket [NC]
    RewriteRule /(.*) ws://localhost:8501/$1 [P,L]
    RewriteCond %{HTTP:Upgrade} !=websocket [NC]
    RewriteRule /(.*) http://localhost:8501/$1 [P,L]

    ProxyPassReverse / http://localhost:8501/

SSLCertificateFile /path/to/cert/
SSLCertificateKeyFile /path/to/key/
</VirtualHost>
</IfModule>

```

Apache2 shows no errors whatsoever. When I try to access [https://my.server-name.com/](https://my.server-name.com/). Browser properly uses HTTPS with certs, I’m also redirected to streamlit app, BUT it’s stuck on:

> “Please wait…”

When I look at the browser console (F12) it shows followsing errors:

```auto
WebsocketConnection WebSocket onerror

```

and:

```auto
Uncaught Error: Unsupported state transition.
State: PINGING_SERVER
Event: CONNECTION_TIMED_OUT

```

and general information:

```auto
WebSocket connection to 'wss://my.server-name.com/stream' failed: WebSocket is closed before the connection is established.

```

Is there anyting that I should pay attention to? The configuration was taken from streamlit deployment guide. I would be glad for any guidance or suggestions.

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/streamlit/original/3X/c/f/cf4c2ee0d938358f82448c5fe4b9c3c91d7ce19c.svg) [@system](https://discuss.streamlit.io/u/system)\
**Post date:** [September 2, 2023, 8:36pm UTC](https://discuss.streamlit.io/t/webscoket-errors-while-proxying-through-https-with-apache2/30180/2 "2023-09-02T20:36:18Z")

</div>

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
