[GH-ISSUE #419] Unable to send from curl when behind reverse proxy #323

Closed
opened 2026-05-07 00:23:03 +02:00 by BreizhHardware · 4 comments

Originally created by @danmed on GitHub (Sep 30, 2022).
Original GitHub issue: https://github.com/binwiederhier/ntfy/issues/419

I've got everything set up and working great in docker.

If i run the below command without a reverse proxy, it all works great

curl -u user:pass -H "X-Priority: 4" -T porch.jpg -H "Filename: /root/porch.jpg" -H "Title: Someone is at the door!" -H "Actions: view, Open Camera, https://user:pass@cameraurl domain.co.uk:82/doorbell

However if i use my reverse proxy and give it a url like ntfy.domain.co.uk (i'm using NginxProxyManager)

when running the above command, i get "301 permanently moved" error in html

My server.yml is :

base-url: https://ntfy.domain.co.uk
listen-http: ":82"
auth-file: "/var/lib/ntfy/user.db"
auth-default-access: "deny-all"
behind-proxy: true
attachment-cache-dir: "/var/cache/ntfy/attachments"
Originally created by @danmed on GitHub (Sep 30, 2022). Original GitHub issue: https://github.com/binwiederhier/ntfy/issues/419 I've got everything set up and working great in docker. If i run the below command without a reverse proxy, it all works great `curl -u user:pass -H "X-Priority: 4" -T porch.jpg -H "Filename: /root/porch.jpg" -H "Title: Someone is at the door!" -H "Actions: view, Open Camera, https://user:pass@cameraurl domain.co.uk:82/doorbell` However if i use my reverse proxy and give it a url like ntfy.domain.co.uk (i'm using NginxProxyManager) when running the above command, i get "301 permanently moved" error in html My server.yml is : ``` base-url: https://ntfy.domain.co.uk listen-http: ":82" auth-file: "/var/lib/ntfy/user.db" auth-default-access: "deny-all" behind-proxy: true attachment-cache-dir: "/var/cache/ntfy/attachments" ```
BreizhHardware 2026-05-07 00:23:03 +02:00
  • closed this issue
  • added the
    question
    label
Author
Owner

@danmed commented on GitHub (Sep 30, 2022):

so it turns out this is a curl thing.. needed the below 2 switches to sort it out

-L --location-trusted

<!-- gh-comment-id:1263511115 --> @danmed commented on GitHub (Sep 30, 2022): so it turns out this is a curl thing.. needed the below 2 switches to sort it out -L --location-trusted
Author
Owner

@binwiederhier commented on GitHub (Sep 30, 2022):

Sounds like your proxy isn't proxying, but rather redirecting. Look at curl -v to see what's happening. Doesn't seem like a ntfy issue though. Feel free to close the ticket.

<!-- gh-comment-id:1263736636 --> @binwiederhier commented on GitHub (Sep 30, 2022): Sounds like your proxy isn't proxying, but rather redirecting. Look at `curl -v` to see what's happening. Doesn't seem like a ntfy issue though. Feel free to close the ticket.
Author
Owner

@dioxide-jazz commented on GitHub (Jul 6, 2023):

sorry to revive a closed issue but @danmed I had this issue with nginx proxy manager and it turned out to be the fact that i had force SSL on.
since its forcing SSL its trying to redirect but cant figure it out i suppose. its almost a year later but i hope this helps you! |

<!-- gh-comment-id:1622731037 --> @dioxide-jazz commented on GitHub (Jul 6, 2023): sorry to revive a closed issue but @danmed I had this issue with nginx proxy manager and it turned out to be the fact that i had force SSL on. since its forcing SSL its trying to redirect but cant figure it out i suppose. its almost a year later but i hope this helps you! |
Author
Owner

@sandreas commented on GitHub (Jul 7, 2024):

For everyone running into this, here is what the sample is like:

curl -d "Hi" mydomain.org/sandreas

If you are behind a proxy, this might not work. Instead you just have to fully qualify the URL including the scheme:

curl -d "Hi" https://mydomain.org/sandreas

which made it work in my case.

Maybe this could be added to the example, if NTFY_BEHIND_PROXY=true...?

<!-- gh-comment-id:2212547148 --> @sandreas commented on GitHub (Jul 7, 2024): For everyone running into this, here is what the sample is like: ```bash curl -d "Hi" mydomain.org/sandreas ``` If you are behind a proxy, this might not work. Instead you just have to fully qualify the URL including the scheme: ```bash curl -d "Hi" https://mydomain.org/sandreas ``` which made it work in my case. Maybe this could be added to the example, if `NTFY_BEHIND_PROXY=true`...?
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/ntfy#323
No description provided.