Skip to content

Conversation

@lee89tw14
Copy link

@lee89tw14 lee89tw14 commented Sep 11, 2025

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):

  • API calls go to 192.168.1.100:8080

FQDN access (e.g., srt.example.com):

  • API calls go to same domain (assumes nginx proxy)

Manual configuration:

  • Setting APP_URL overrides auto-detection

Compatibility

  • Existing configurations continue to work
  • No breaking changes

Fixes #2

… 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
@servusrene
Copy link
Member

@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.

@lee89tw14
Copy link
Author

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.
(on my own use scenario, I want to check the web UI outside, also don't want any web service exposed directly via my public IP, so even I could just also map port 3000, I still love to access it via cloudflare tunnel via proxy)

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?

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.

some improvement?

2 participants