androidseb25 / iGotify-Notification-Assistent

Docker container for sending Gotify notifications to iOS devices (bridge to gotify websocket)
MIT License
131 stars 6 forks source link

[BUG] API cannot be accessed behind reverse proxy path #36

Closed marchein closed 7 months ago

marchein commented 7 months ago

Describe the bug Currently I have both the gotify and igotify container published using a nginx reverse proxy. The gotify container is published with the domain gotify.domain.tld and the api container using gotify-api.domain.tld. Now I tried using the location and proxy_pass parameter of nginx and publish the api at gotify.domain.tld/api/. If I open this url in the browser I get the same igotify api page.

I tried to setup the igotify app which cannot access the api as it seems...

Expected behavior The app would connect exactly like it would with the gotify-api.domain.tld entry.

Screenshots If applicable, add screenshots to help explain your problem. image

Smartphone (please complete the following information):

Additional context Add any other context about the problem here.

androidseb25 commented 7 months ago

I think the problem would be the routing of the api,

did you try with postman if you can access the api endpoinds?

marchein commented 7 months ago

I tried just the /version route which delivers the exact same result: https://gotify-api.domain.tld/version vs. https://gotify.domain.tld/api/version:

{
    "version": "1.1.0.0",
    "commit": "5a352c275cdc4920b865a96c945aecc7",
    "buildDate": "2024-02-01T11:03:40"
}
androidseb25 commented 7 months ago

Did you try the other endpoints? Every endpoint of the other must be response with an error when you try it with dummy data

marchein commented 7 months ago

All results of the different endpoints are the same across both hosts.

{
    "Message": "Fehler beim hinzugefügen des Gerätes!",
    "Successful": false
}
{
    "Message": "Fehler beim löschen des Gerätes!",
    "Successful": false
}
androidseb25 commented 7 months ago

how do you write the api?

did you write the url like this: gotify.domain.tld/api? when yes try to add it without /api because the app call at this point gotify.domain.tld/api/api/version

marchein commented 7 months ago

I tried without the /api now and that let me login.

Now I receive this error.. tried reinstalling, restarting the iGotify container and deleting the iOS clients in gotify ...

image


09:53:58.658 INFO Logger.getInstance():30 - ♻️ - Initialize iGotify Logger

09:53:58.665 INFO SecNtfy.initialize():65 - ♻️ - API URL https://api.secntfy.app

09:53:58.667 INFO SecNtfy.initialize():66 - ♻️ - Bundle Group group.sr.iGotify

09:53:58.887 INFO SecNtfy.initialize():77 - PubKey: MIIBCgKCAQEAwUxKzLs5Cu/63vULgxJGb4vHG+aXyll3vq5Z9hbBgQ5KjhBwPWCYay+ozrAqYXsxPl2k5MfJRidjfG4/bUTZgVLA+AjGmm0zaFhengyG5SwiWkEL9Js1oP7ZYkOcZrlp9Vp8pZYZ94QhNeioZNt/fA1MB/kZ5LpvVtDRMQr4KFfcfF+vJjaPe970pE/h0lDRfmnNIkKESVtg5E6O6XB/U6k3PGG18kQ8zuCG7BkJw2LmwFAk7jfxMbgVh3ayHajbaIfAdaq/rCrEmEf3odCXWl/iZRx8KEjDwC9MP76P2IplC17etWremwyg/VZjkZCbG/F+T4C85C6K2EVnMbIhFwIDAQAB

09:53:58.890 INFO SecNtfy.initialize():78 - PrivKey: MIIEo*****D5elQ

09:53:58.894 INFO SecNtfy.configure():102 - Model: iPhone 15

09:53:58.896 INFO SecNtfy.configure():103 - OS: 17.3.1

09:53:58.898 INFO SecNtfy.configure():105 - PubKey: MIIBCgKCAQEAwUxKzLs5Cu/63vULgxJGb4vHG+aXyll3vq5Z9hbBgQ5KjhBwPWCYay+ozrAqYXsxPl2k5MfJRidjfG4/bUTZgVLA+AjGmm0zaFhengyG5SwiWkEL9Js1oP7ZYkOcZrlp9Vp8pZYZ94QhNeioZNt/fA1MB/kZ5LpvVtDRMQr4KFfcfF+vJjaPe970pE/h0lDRfmnNIkKESVtg5E6O6XB/U6k3PGG18kQ8zuCG7BkJw2LmwFAk7jfxMbgVh3ayHajbaIfAdaq/rCrEmEf3odCXWl/iZRx8KEjDwC9MP76P2IplC17etWremwyg/VZjkZCbG/F+T4C85C6K2EVnMbIhFwIDAQAB

09:53:58.901 INFO SecNtfy.configure():106 - PrivKey: MIIEo*****D5elQ

09:53:59.050 VERBOSE AppDelegate.application():83 - APNs token retrieved: 32 bytes

09:53:59.053 VERBOSE AppDelegate.application():86 - The token: 6D398*****DD77F

09:53:59.055 INFO SecNtfy.setApnsToken():132 - 6D398*****DD77F

09:54:46.480 INFO SecNtfy.getInstance():43 - ♻️ - instance init

09:54:46.608 ERROR SecNtfy.PostDevice():162 - 🔥 - Failed task Es wurde kein Server mit dem angegebenen Hostnamen gefunden.

09:54:46.615 ERROR ContentView.sendFCMToken():27 - getNtfyToken: Optional("Es wurde kein Server mit dem angegebenen Hostnamen gefunden.")

09:54:46.621 ERROR ContentView.sendFCMToken():27 - getNtfyToken: Optional("Es wurde kein Server mit dem angegebenen Hostnamen gefunden.")
androidseb25 commented 7 months ago

Ok good, did you're find blocker block a domain with api.secntfy.app?

marchein commented 7 months ago

I just checked in my AdGuard, but no, it is not blocked image

androidseb25 commented 7 months ago

Strange this is normally the issue 🤔 I have currently no ideas why you can't connect

the site secntfy.app can you open?

MaxGrmm commented 7 months ago

I tried without the /api now and that let me login.

Now I receive this error.. tried reinstalling, restarting the iGotify container and deleting the iOS clients in gotify ...

image


09:53:58.658 INFO Logger.getInstance():30 - ♻️ - Initialize iGotify Logger

09:53:58.665 INFO SecNtfy.initialize():65 - ♻️ - API URL https://api.secntfy.app

09:53:58.667 INFO SecNtfy.initialize():66 - ♻️ - Bundle Group group.sr.iGotify

09:53:58.887 INFO SecNtfy.initialize():77 - PubKey: MIIBCgKCAQEAwUxKzLs5Cu/63vULgxJGb4vHG+aXyll3vq5Z9hbBgQ5KjhBwPWCYay+ozrAqYXsxPl2k5MfJRidjfG4/bUTZgVLA+AjGmm0zaFhengyG5SwiWkEL9Js1oP7ZYkOcZrlp9Vp8pZYZ94QhNeioZNt/fA1MB/kZ5LpvVtDRMQr4KFfcfF+vJjaPe970pE/h0lDRfmnNIkKESVtg5E6O6XB/U6k3PGG18kQ8zuCG7BkJw2LmwFAk7jfxMbgVh3ayHajbaIfAdaq/rCrEmEf3odCXWl/iZRx8KEjDwC9MP76P2IplC17etWremwyg/VZjkZCbG/F+T4C85C6K2EVnMbIhFwIDAQAB

09:53:58.890 INFO SecNtfy.initialize():78 - PrivKey: MIIEo*****D5elQ

09:53:58.894 INFO SecNtfy.configure():102 - Model: iPhone 15

09:53:58.896 INFO SecNtfy.configure():103 - OS: 17.3.1

09:53:58.898 INFO SecNtfy.configure():105 - PubKey: MIIBCgKCAQEAwUxKzLs5Cu/63vULgxJGb4vHG+aXyll3vq5Z9hbBgQ5KjhBwPWCYay+ozrAqYXsxPl2k5MfJRidjfG4/bUTZgVLA+AjGmm0zaFhengyG5SwiWkEL9Js1oP7ZYkOcZrlp9Vp8pZYZ94QhNeioZNt/fA1MB/kZ5LpvVtDRMQr4KFfcfF+vJjaPe970pE/h0lDRfmnNIkKESVtg5E6O6XB/U6k3PGG18kQ8zuCG7BkJw2LmwFAk7jfxMbgVh3ayHajbaIfAdaq/rCrEmEf3odCXWl/iZRx8KEjDwC9MP76P2IplC17etWremwyg/VZjkZCbG/F+T4C85C6K2EVnMbIhFwIDAQAB

09:53:58.901 INFO SecNtfy.configure():106 - PrivKey: MIIEo*****D5elQ

09:53:59.050 VERBOSE AppDelegate.application():83 - APNs token retrieved: 32 bytes

09:53:59.053 VERBOSE AppDelegate.application():86 - The token: 6D398*****DD77F

09:53:59.055 INFO SecNtfy.setApnsToken():132 - 6D398*****DD77F

09:54:46.480 INFO SecNtfy.getInstance():43 - ♻️ - instance init

09:54:46.608 ERROR SecNtfy.PostDevice():162 - 🔥 - Failed task Es wurde kein Server mit dem angegebenen Hostnamen gefunden.

09:54:46.615 ERROR ContentView.sendFCMToken():27 - getNtfyToken: Optional("Es wurde kein Server mit dem angegebenen Hostnamen gefunden.")

09:54:46.621 ERROR ContentView.sendFCMToken():27 - getNtfyToken: Optional("Es wurde kein Server mit dem angegebenen Hostnamen gefunden.")

Habe das gleiche Verhalten wie der Kollege über mir… Sehe die Mitteilungen in der App aber bekomme keine Push Messages mehr. im AD GURAD wird ebenfalls nichts geblockt Token schon neu erstellt und Container geupdatet

androidseb25 commented 7 months ago

Siehst du die Webseite secntfy.app? Weil er kann genau den Punkt zu secntfy nicht auflösen

MaxGrmm commented 7 months ago

Ja ich sehe die Webseite und auch das die Anfragen verarbeitet werden. Screenshot 2024-02-15 121947

Was aber tatsächlich komisch ist, das es über das Mobilfunknetz läuft also auch die Push Notifications. Vielleicht doch noch ein DNS Thema .... ich schaue mir das nochmal genau an

androidseb25 commented 7 months ago

Ok, gut gibt es vielleicht noch ne Firewall davor die die Adresse blocken könnte?

MaxGrmm commented 7 months ago

Habe mal im ADGUARD ne manuelle Freigabe auf die von dir genannte Domain inkl. Sub-Domains gemacht. Scheinbar funktioniert es jetzt.

Benutzerdefinierte Filterregel:

Freigabe für iGotify

@@||secntfy.app^

image

Werde das ganze mal im Blick behalten ggf. hilft die Lösung bei @marchein auch. Hoffe er spricht auch Deutsch, sonst schreibe ich das ganze nochmal in EN.

androidseb25 commented 7 months ago

Habe mal im ADGUARD ne manuelle Freigabe auf die von dir genannte Domain inkl. Sub-Domains gemacht. Scheinbar funktioniert es jetzt.

Benutzerdefinierte Filterregel:

Freigabe für iGotify @@||secntfy.app^

image

Werde das ganze mal im Blick behalten ggf. hilft die Lösung bei @marchein auch. Hoffe er spricht auch Deutsch, sonst schreibe ich das ganze nochmal in EN.

Ok gut zu wissen, kommt anscheinend drauf an wie stark die DNS Listen sind.

Ich glaub @marchein wird deutsch sprechen, so wie die Screenshots aussehen :)

marchein commented 7 months ago

Danke für den Vorschlag!

Ich bevorzuge es in Github Issues auf Englisch zu schreiben, sodass mehr Menschen Zugang zu einer potenziellen Lösung haben. Von daher...

I tried adding the rule to my DNS and I got further. But still no luck....

Now I receive this message within the iGotify Docker Container:

Message converted: {"id":4,"appid":2,"message":"```\nThis is a test of the notification target 'Gotify'\n```","title":"Test notification","priority":1,"extras":{"clientdisplay":{"contentType":"text/markdown"}},"date":"2024-02-17T10:20:19.822767958+01:00"}

NO DEVICES FOUND FOR SENDING MESSAGES!

Maybe its because the Container expects an API Path of https://domain.tld/ instead of https://domain.tld/api/?


But it is now possible to read the notifications within the iGotify app. So there's that...


But the app is still displaying the same error..

10:32:13.006 VERBOSE AppDelegate.application():83 - APNs token retrieved: 32 bytes

10:32:13.010 VERBOSE AppDelegate.application():86 - The token: 3AF9A*****74BB4

10:32:13.012 INFO SecNtfy.setApnsToken():132 - 3AF9A*****74BB4

10:32:14.480 INFO SecNtfy.getInstance():43 - ♻️ - instance init

10:32:14.515 ERROR SecNtfy.PostDevice():162 - 🔥 - Failed task Es wurde kein Server mit dem angegebenen Hostnamen gefunden.

10:32:14.522 ERROR ContentView.sendFCMToken():27 - getNtfyToken: Optional("Es wurde kein Server mit dem angegebenen Hostnamen gefunden.")

10:32:14.529 ERROR ContentView.sendFCMToken():27 - getNtfyToken: Optional("Es wurde kein Server mit dem angegebenen Hostnamen gefunden.")
androidseb25 commented 7 months ago

I think it's nothing with the container or gotify because he get a connection. (The notification shows up from gotify in the app)

The notification you get in the container that no device is found is correct, because he didn't received the device token from the app.

The reason why the app can't connect to https://api.secntfy.app for getting this device token is for me a big mystery.

There must be something in you're network that block the connection to it 🤔 like a firewall rule or something with the dns or a VPN?

Did you try it with cellular on and WiFi off?

marchein commented 7 months ago

I get the same behavior with wifi off and using only my phones cellular data...

androidseb25 commented 7 months ago

I get the same behavior with wifi off and using only my phones cellular data...

thats crazy 🤔 i checked at the moment if the IP or domain is blacklist somewhere but everything is good.

I have no ideas why you can't connect...

marchein commented 7 months ago

Even tried multiple times to reinstall the app, disabled the private relay feature of iOS, rebooted the phone, tried my iPad instead of the iphone..

androidseb25 commented 7 months ago

please take a look at the release on wednesday maybe it fix you're error

androidseb25 commented 7 months ago

Hi i hope the new version will maybe fix everything please take a try.

Assistent v1.2 is live, app is following

marchein commented 7 months ago

Hi, thank you for the new version.

Its working now, thanks!