AzuraCast / AzuraCast

A self-hosted web radio management suite, including turnkey installer tools for the full radio software stack and a modern, easy-to-use web app to manage your stations.
https://www.azuracast.com/
GNU Affero General Public License v3.0
3.01k stars 557 forks source link

Some API endpoints aren't working with an access through an IP-Address #4352

Closed maestro300 closed 3 years ago

maestro300 commented 3 years ago

Using Docker installation method? yes

AzuraCast version: v0.13.0

Host Operating System: Debian Linux 10 (Virtual Machine)

Describe the bug: When i'm trying to use the api via IP some of the endpoints are redirecting to the login page or response with an empty page

for example https://[my IP]/api/nowplaying results in an empty response https://[my IP]/api/nowplaying/1 is working https://[my IP]/api/stations results in an empty response https://[my IP]/api/station/1 is working https://[my IP]/api/station/1/history redirects to login screen https://[my IP]/api/station/1/status redirects to login screen https://[my IP]/api/station/1/listeners redirects to login screen

Steps to reproduce: 1) open browser 2) navigate to https://[your server IP]/api/station/1/history

Expected behavior: get a json response from the endpoints

Relevant logs: nginx_proxy | nginx.1 | 192.168.1.113 192.168.1.200 - - [27/Jun/2021:16:31:14 +0000] "GET /api/station/1/status HTTP/2.0" 302 0 "-" "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:88.0) Gecko/20100101 Firefox/88.0" nginx_proxy | nginx.1 | 192.168.1.113 192.168.1.200 - - [27/Jun/2021:16:31:14 +0000] "GET / HTTP/2.0" 302 0 "-" "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:88.0) Gecko/20100101 Firefox/88.0" nginx_proxy | nginx.1 | 192.168.1.113 192.168.1.200 - - [27/Jun/2021:16:31:14 +0000] "GET /login HTTP/2.0" 200 1734 "-" "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:88.0) Gecko/20100101 Firefox/88.0"

Device(s):

Additional context: the Debian is a Virtual machine and can be accessed through a internal privat IP from other VMs or via Public IP. It doesn't seem to matter which IP I'm using

what could i do to fix this?

ItsMitchh commented 3 years ago

can you use the format please :)

maestro300 commented 3 years ago

can you use the format please :)

i formatted the original post

BusterNeece commented 3 years ago

@maestro300 The endpoints that require login appear to be normal, as those require authentication via an API key since they contain sensitive information.

The reason the non-station-ID-specific endpoints may be returning empty would be if you've disabled the "Is Public" setting on your station, which would hide it from any API endpoints that return all stations on the installation. The endpoints for that one specific station will continue to respond as normal (to allow you to use the API for normal purposes for your station) but any bulk listing of stations wouldn't include the non-public ones.

maestro300 commented 3 years ago

@SlvrEagle23 ah then i read the api documentation wrong - i only now noticed the little lock symbol and assumed that no api key is required ... my bad

ItsMitchh commented 3 years ago

Seems to be resolved, tag me if there's any further issues.