notify_push icon indicating copy to clipboard operation
notify_push copied to clipboard

Enhancement: use gethostbyname for dynamic trusted_proxies (like php of nextcloud does)

Open jonathanmmm opened this issue 3 years ago • 6 comments

Hi, I have setup all correctly, but I get:

push server is not a trusted proxy, please add '172.22.1.1' to the list of trusted proxies or configure any existing reverse proxy to forward the 'x-forwarded-for' send by the push server. As you can see, is 172.22.1.1 a dynamic ip from docker, I use multiple docker-compose files and and multiple networks (dynamic ips), is there any way to dynamically. Setting the ip of this docker network to static would make it less flexible, so something like gethostbyname would be great, if it would work also for notify_push:

https://github.com/nextcloud/documentation/issues/7005#issuecomment-845993541

jonathanmmm avatar Aug 14 '21 21:08 jonathanmmm

the push daemon doesn't check the trusted proxies itself, it just adds itself to the list of proxies the request has passed trough. So any trick that can be used by nextcloud should work fine with notify_push to

icewind1991 avatar Aug 18 '21 12:08 icewind1991

Here is the error in my docker container:

 Error:
nextcloud-notify_push    |    0: Failed to parse config
nextcloud-notify_push    |    1: Failed to parse nextcloud config
nextcloud-notify_push    |    2: Error while parsing php literal:
nextcloud-notify_push    |    2: .. |
nextcloud-notify_push    |    2: 79 |   'trusted_proxies' =>
nextcloud-notify_push    |    2: 80 |     array (
nextcloud-notify_push    |    2: 81 |       0 => gethostbyname('nginx'),
nextcloud-notify_push    |    2:    |            ^^ No valid token found, expected one of [Bool, Integer, Float, LiteralString, Null, Array, SquareOpen]
nextcloud-notify_push    |    2: 82 |     ),
nextcloud-notify_push    |    2: 83 | );
nextcloud-notify_push    |    2:

jonathanmmm avatar Aug 18 '21 13:08 jonathanmmm

I am facing the same issue. I need gethostbyname() in trusted_proxies for dynamic docker IPs which change on container recreation. Thats currently not possible with notify_push and results in the above error.

ghost avatar Feb 28 '22 19:02 ghost

this would be great!

HerrFrutti avatar Jul 12 '23 21:07 HerrFrutti

I would like to see this as well. I am currently in the process of trying to follow this after upgrading to Nextcloud 29. And it feels like it might be a major piece to getting notify_push working within docker

S0ulf3re avatar Apr 27 '24 17:04 S0ulf3re

I recently switched my Docker stacks from static IPs to hostnames, as this is much easier to maintain. Unfortunately, I also realized that push_notify no longer works in this case.

hampoelz avatar Apr 30 '24 18:04 hampoelz