Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Push notifications not working behind Apache reverse proxy #169

Closed
gelse opened this issue Apr 18, 2021 · 2 comments
Closed

Push notifications not working behind Apache reverse proxy #169

gelse opened this issue Apr 18, 2021 · 2 comments

Comments

@gelse
Copy link

gelse commented Apr 18, 2021

Hi,
as said i incorrectly posted in #24 :

Versions

  • docker image 2.0.22
  • apache2 2.4.29

Configs:

  • docker-compose.yml
version: "3"
services:
#############################################
  gotify:
    image: gotify/server
    container_name: gotify
    restart: unless-stopped
    environment:
      - PUID=1000
      - PGID=1000
      - TZ=Europe/Vienna
      - GOTIFY_DEFAULTUSER_PASS=youWish!
    volumes:
      - ./data:/app/data
    ports:
      - 127.0.0.1:8088:80
#############################################
  • Apache conf
<VirtualHost *:443>
    SSLEngine on
    SSLProxyEngine on
    SSLCipherSuite ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP:+eNULL
    SSLCertificateFile    /etc/letsencrypt/live/my.domain/fullchain.pem
    SSLCertificateKeyFile /etc/letsencrypt/live/my.domain/privkey.pem
    SSLCertificateChainFile /etc/letsencrypt/live/my.domain/fullchain.pem

    ServerName my.domain
    ServerAdmin my.email

    ProxyPreserveHost On

    <Location "/" >
        RequestHeader set X-SCHEME https
        ProxyPass http://localhost:8088/
        ProxyPassReverse http://localhost:8088/
        RequestHeader set X-Forwarded-Proto "https"
    </Location>
</VirtualHost>

Logs:

  • android client
2021-04-18T07:35:42.303Z INFO: Entering LogsActivity
2021-04-18T07:35:37.768Z INFO: Removing message with id 63
2021-04-18T07:35:28.287Z INFO: Loading more messages for -1
2021-04-18T07:35:28.262Z INFO: Entering MessagesActivity
2021-04-18T07:35:28.251Z INFO: WebSocket(1): closing existing connection.
2021-04-18T07:35:28.249Z ERROR: WebSocket(1): failure StatusCode: 400 Message: Bad Request
java.net.ProtocolException: Expected HTTP 101 response but was '400 Bad Request'
at okhttp3.internal.ws.RealWebSocket.checkResponse(RealWebSocket.java:229)
at okhttp3.internal.ws.RealWebSocket$2.onResponse(RealWebSocket.java:196)
at okhttp3.RealCall$AsyncCall.execute(RealCall.java:206)
at okhttp3.internal.NamedRunnable.run(NamedRunnable.java:32)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
at java.lang.Thread.run(Thread.java:919)

2021-04-18T07:35:28.181Z INFO: Server version: 2.0.22@2021-04-16-18:16:19
2021-04-18T07:35:28.087Z INFO: Network reconnected
2021-04-18T07:35:28.074Z INFO: WebSocket(1): starting...
2021-04-18T07:35:28.035Z INFO: Starting WebSocketService
2021-04-18T07:35:28.028Z INFO: Create WebSocketService
2021-04-18T07:35:28.020Z INFO: Authenticated as admin
2021-04-18T07:35:27.875Z INFO: Entering InitializationActivity
2021-04-18T07:35:03.957Z INFO: Entering LoginActivity
2021-04-18T07:35:03.846Z INFO: Entering InitializationActivity
  • webserver
[GIN] 2021/04/18 - 11:04:29 | 400 |     372.168µs |   185.85.32.243 | GET      "/stream?token=myToken"
Error #01: websocket: the client is not using the websocket protocol: 'upgrade' token not found in 'Connection' header

Experience

  • Client seems to work when browsing
  • Client does NOT get push notifications

That seems to be consistent with the error log on the server - i am not sure, either i am missing some configuration for the apache reverse proxy or it really is a bug.
i would more think it's a problem on my side, but i do not know yet which.

And yes! I want to drop apache, too! i just don't have time for that currently, at least it is now only working as a reverse-proxy for docker instances, but for the time being i am stuck with it.

@gelse gelse changed the title Push notifications not working Push notifications not working behind Apache reverse proxy Apr 18, 2021
@jmattheis
Copy link
Member

jmattheis commented Apr 18, 2021

You are missing some apache configuration for the websocket -> https://gotify.net/docs/apache

ProxyPass "/stream" ws://127.0.0.1:8080/stream retry=0 timeout=5

@gelse
Copy link
Author

gelse commented Apr 18, 2021

uh, from some reason i did not find that doc ... thanks for the assistance.

@gelse gelse closed this as completed Apr 18, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants