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

apache2-ycast.conf.example #108

Closed
dkarnout opened this issue Nov 26, 2021 · 5 comments
Closed

apache2-ycast.conf.example #108

dkarnout opened this issue Nov 26, 2021 · 5 comments

Comments

@dkarnout
Copy link

dkarnout commented Nov 26, 2021

Hi!
I would be glad if there could be an apache2-ycast.conf.example like nginx-ycast.conf.example, while i am a server noob, my home server runs already apache2 and i would not load it with so many services.
I would like to test it using a Marantz NA7004.

The following does a 'Server Error' on NA7004's screen. Thanks in advance!

<VirtualHost _default_:80>
  ServerName marantz.vtuner.com
  ServerAlias denon.vtuner.com
  ServerAlias denon2.vtuner.com
  <Location />
    ProxyPreserveHost On
    RequestHeader set X-Real-IP expr=%{REMOTE_ADDR}
    RequestHeader set X-Forwarded-For expr=%{REMOTE_ADDR}
    RequestHeader set X-Forwarded-Proto expr=%{REQUEST_SCHEME}

    ProxyPass http://127.0.0.1:8010/
    ProxyPassReverse http://127.0.0.1:8010/
  </Location>
  ErrorLog ${APACHE_LOG_DIR}/error.vtuner.log
  CustomLog ${APACHE_LOG_DIR}/access.vtuner.log combined
</VirtualHost>
@dkarnout
Copy link
Author

dkarnout commented Nov 27, 2021

UPDATE if it helps:
The following does not a 'Server Error' anymore, but shows 'Internet radio' and does not show 'Search by genre', etc:
I believe my error is at X-Forwarded-For...

<VirtualHost _default_:80>
  ServerName marantz.vtuner.com
  ServerAlias radiomarantz.com
  <Location />
    ProxyPreserveHost On
    RequestHeader set X-Real-IP %{REMOTE_ADDR}s
    RequestHeader set X-Forwarded-For %{REMOTE_ADDR}s
    RequestHeader set X-Forwarded-Proto %{REQUEST_SCHEME}s
 #          proxy_redirect  off;
 #          proxy_set_header Host $host;
 #          proxy_set_header X-Real-IP $remote_addr;
 #          proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
 #          proxy_set_header X-Forwarded-Proto $scheme;
    ProxyPass http://127.0.0.1:8010/
    ProxyPassReverse http://127.0.0.1:8010/
  </Location>
  ErrorLog ${APACHE_LOG_DIR}/error.vtuner.log
  CustomLog ${APACHE_LOG_DIR}/access.vtuner.log combined
</VirtualHost>

@SpeedyGoneZales
Copy link

It's not directly related to the apache2 config, but when I brought up a virtual machine on CentOs 9 recently, I ran into trouble with running yCast on the local loopback interface and firewalld.
The workaround was to not tie yCast to the localhost interface, and use firewalld to redirect port 80 like so:

yCast

/usr/bin/python3 -m ycast -p 8010 -c /etc/ycast/stations.yaml -d   

(note how -l 127.0.0.1 is absent from the above config).

firewalld

sudo firewall-cmd --zone=public --add-forward-port=port=80:proto=tcp:toport=8010   
sudo firewall-cmd --runtime-to-permanent

This is a single-purpose set-up, so I don't need to worry much about running a webserver or anything else.

@dkarnout
Copy link
Author

Thanks for your idea 👍 , just implemented it with iptables (only for my LAN, because I have external http requests):
sudo iptables -t nat -A PREROUTING -s 192.168.1.1/24 -p tcp --dport 80 -j REDIRECT --to-port 8010
Everything works ok from my home LAN devices, except from my NA7004 😞 which asks me to visit radiomarantz.com...
So I believe that it looks directly into an IP and not into a domain.
Any other device from my LAN is redirected correctly to myhomeserver/ycast from:

radiomarantz.com
*.vtuner.com

Someday I may try to sniff NA7004's requests and keep up inform any interested.

@SpeedyGoneZales
Copy link

@dkarnout, I'm glad it helped you. An http server is of course a much better solution, but I have only a single device, so I guess for that use case it's ok.

I don't have an NA7004, but I'd be surprised if it's a different logic to mine (MCR610); is the DNS server set correctly on your NA7004?
I'm only redirecting *.vtuner.com and vtuner.com, which I'm doing directly on my router, and the MCR610 receives the router's IP address as DNS server via DHCP. The former should cover denon.vtuner.com, which I believe is what Marantz uses.
My MCR610 does occasionally lose network connectivity completely, I am only able to restore it by resetting it completely in this case (unplug the power, and hold the <M-DAX> and <DISPLAY> buttons while plugging it back in). This means losing all settings unfortunately...

@dkarnout
Copy link
Author

@SpeedyGoneZales I managed it with your help (again)! The problem was NA7004's DNS setting as you said.
While had already put my router IP (192.168.1.1) at:
Menu -> Network -> Connection -> Primary DNS, the value does not store until you follow after that
Menu -> Network -> Connection -> Connection, and that was my problem.

So I can confirm yCast works flawlessly for NA7004 with mandatory both local DNS records:
denon.vtuner.com and
denon2.vtuner.com.
Thank you again and do have nice holidays!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants