-
Notifications
You must be signed in to change notification settings - Fork 4
Add Dynamic Backend Configuration #4
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
base: main
Are you sure you want to change the base?
Conversation
… access - Add intelligent detection of access method (IP vs FQDN) - Support for nginx reverse proxy configurations - New REACT_APP_API_PROXY_PATH environment variable - Automatic backend URL selection based on access method - Updated documentation and examples - Backward compatible with existing configurations Resolves the inconsistency between nginx proxy (FQDN) and local network (IP) access
- Fix run.js to handle undefined environment variables properly - Add debug logging to config.ts for better troubleshooting - Ensure placeholder replacement doesn't insert 'undefined' strings - Improve FQDN detection and URL generation logic Resolves: GET https://srt.rukkafran.xyzundefined/api/stream-ids net::ERR_NAME_NOT_RESOLVED
- Remove all console.log debug statements from config.ts - Clean up logging for production-ready deployment - Maintain all dynamic configuration functionality
- Move documentation to external location - Clean up repository for production deployment - Documentation preserved in separate backup location
|
@lee89tw14 first of all, thank you for your contribution. I find automatic detection too inaccurate. Currently, the app is designed to run the entire stack on a server without a proxy as easily as possible. In my opinion, APP_URL should be replaced by SRT_HOST, STATS_HOST and API_HOST. For a transition period, it should still be possible to set APP_URL - this sets all variables. |
|
ah, I saw the problem. when the APP_URL been set, it just ruined the whole thing. I guess that the stack for original purpose is for running on headless server? (VPS or something?) Just thought it may be good for running on home-lab or any server that could not easily get the public IP to run, and maybe want to access the web-UI via any tunnel service. maybe just should not setting APP_URL? for my own build, it works for me, from tailscale network to local network, and FQDN access also correctly display the streamid blocks, which the stat page can also correctly display. For public IP access , after map the port on my router, it also showing good. yet, the IP detecting logic might not be good enough, but I think this may be more easily for accessing w/o setting any hard link; though it may also cause some potential issue? |
Changes
.env.example
Added detailed comments and nginx configuration examples
Made APP_URL optional (empty value enables auto-detection)
Added port configuration documentation
config.ts
Added getDynamicApiEndpoint() function to detect IP vs FQDN access
Added automatic endpoint generation based on current hostname
Added fallback handling for missing environment variables
react-app-env.d.ts (new file)
Added TypeScript interface for environment variables
run.js
Added || '' fallbacks to prevent undefined values during build
url-generator.ts
Added isAccessingViaFqdn() function
Updated generateStatsUrl() to handle FQDN access without explicit ports
Behavior
Direct IP access (e.g., 192.168.1.100:3000):
FQDN access (e.g., srt.example.com):
Manual configuration:
Compatibility
Fixes #2