Skip to content

Add NAS web UI reverse proxy at nas.jasonernst.com#390

Open
compscidr wants to merge 2 commits intomainfrom
jason/nas-web-proxy
Open

Add NAS web UI reverse proxy at nas.jasonernst.com#390
compscidr wants to merge 2 commits intomainfrom
jason/nas-web-proxy

Conversation

@compscidr
Copy link
Copy Markdown
Owner

Summary

  • Deploy a lightweight nginx:alpine container that proxies nas.jasonernst.com to the host's port 9999 (NAS web management UI)
  • Uses host.docker.internal (via extra_hosts: host-gateway) to reach the host from inside the container
  • VIRTUAL_HOST/LETSENCRYPT env vars for automatic nginx-proxy discovery and SSL
  • No terraform changes needed — nas.jasonernst.com DNS already exists via dyndns

Test plan

  • Deploy with ansible-playbook -i inventory.yml nas.yml --tags "nas-proxy"
  • Verify nas.jasonernst.com loads the NAS web UI with SSL

🤖 Generated with Claude Code

Deploy a lightweight nginx:alpine container that proxies
nas.jasonernst.com to the host's port 9999 (NAS web UI).
Uses host.docker.internal to reach the host from the container,
and VIRTUAL_HOST for nginx-proxy auto-discovery with SSL.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings April 7, 2026 02:43
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds an Ansible-managed reverse proxy container on the NAS to expose the NAS web management UI at nas.jasonernst.com via the existing jwilder/nginx-proxy + Let’s Encrypt companion setup in the media_server role.

Changes:

  • Creates /etc/nas-proxy and ships an nginx default.conf for proxying to host port 9999.
  • Deploys an nginx:alpine nas-proxy container configured for nginx-proxy/Let’s Encrypt discovery and host reachability via host.docker.internal.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
ansible/roles/media_server/tasks/main.yml Adds tasks to create NAS proxy config directory, copy nginx config, and deploy the nas-proxy container on the media network.
ansible/roles/media_server/files/nas-proxy.conf Introduces nginx server config to proxy requests to http://host.docker.internal:9999.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +91 to +99
- name: Copy NAS proxy nginx config
tags: nas-proxy
become: true
ansible.builtin.copy:
src: nas-proxy.conf
dest: /etc/nas-proxy/default.conf
mode: '644'
owner: root
group: root
Copy link

Copilot AI Apr 7, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updates to /etc/nas-proxy/default.conf won’t automatically trigger nginx inside the nas-proxy container to reload, and docker_container won’t detect changes to the bind-mounted file. Consider adding a notify handler to restart/recreate the nas-proxy container when this copy task changes (or set the container task to recreate: true if restart-on-change isn’t feasible).

Copilot uses AI. Check for mistakes.
Comment on lines +5 to +11
location / {
proxy_pass http://host.docker.internal:9999;
proxy_set_header Host $http_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;
}
Copy link

Copilot AI Apr 7, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This reverse proxy exposes the NAS management UI directly to the public internet (via nginx-proxy + LetsEncrypt) without any additional access controls at the proxy layer. For a management interface, consider restricting access (e.g., IP allowlist/denylist, auth_basic, or requiring VPN-only access) to reduce the blast radius if the NAS UI has a vuln or weak auth.

Copilot uses AI. Check for mistakes.
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

Successfully merging this pull request may close these issues.

2 participants