https://github.com/mokira3d48/redic_serv
Python script that creates a Flask web server using Gunicorn to redirect all requests to a URL provided as a command-line argument.
https://github.com/mokira3d48/redic_serv
flask-application gunicorn-web-server http-redirect http-server python-server
Last synced: 8 months ago
JSON representation
Python script that creates a Flask web server using Gunicorn to redirect all requests to a URL provided as a command-line argument.
- Host: GitHub
- URL: https://github.com/mokira3d48/redic_serv
- Owner: mokira3d48
- License: apache-2.0
- Created: 2025-09-16T05:57:17.000Z (9 months ago)
- Default Branch: master
- Last Pushed: 2025-09-16T06:49:21.000Z (9 months ago)
- Last Synced: 2025-09-16T08:13:30.153Z (9 months ago)
- Topics: flask-application, gunicorn-web-server, http-redirect, http-server, python-server
- Language: Python
- Homepage:
- Size: 20.5 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# REDIC_SERV




Python script that creates a Flask web server using Gunicorn
to redirect all requests to a URL provided as a command-line argument.
To use this script:
1. **Install required dependencies**:
```bash
pip install flask gunicorn
```
2. **Run with Flask development server** (for testing):
```bash
python redicserv.py "https://google.com"
```
or
```bash
./redicserv.py "https://google.com"
```
3. **Run with Gunicorn** (for production):
```bash
gunicorn redicserv:app -b 0.0.0.0:8000
```
When using Gunicorn, set the redirect URL via environment variable:
```bash
export REDIRECT_URL="https://google.com"
gunicorn redicserv:app -b 0.0.0.0:8000
```
## Key Features:
- **Command-line argument support** - Accepts URL as command-line argument.
- **Environment variable fallback** - Supports `REDIRECT_URL` environment
variable for Gunicorn compatibility.
- **Wildcard routing** - Catches all paths and redirects to target URL.
- **URL validation** - Automatically adds `https://` prefix if missing.
- **Production-ready** - Works with Gunicorn WSGI server.
## Advanced Configuration:
For production use, create a Gunicorn configuration file `gunicorn_conf.py`:
```python
bind = "0.0.0.0:8000"
workers = 4
worker_class = "sync"
timeout = 120
```
Run with config file:
```bash
gunicorn redicserv:app -c gunicorn_conf.py
```
The server will redirect all incoming requests (any path)
to the specified URL with HTTP 302 status code (temporary redirect).
For permanent redirects, change the code parameter to `301`
in the `redirect()` call.
```bash
export REDIRECT_URL="https://google.com"
gunicorn redicserv:app -b 0.0.0.0:8000
```
## Licence
This project is licensed under the Apache 2.0 License.
See the file [LICENSE](LICENSE) for more details, contact me please.
## Contact
For your question or suggestion, contact me please :
- **Names**: DOCTOR MOKIRA
- **Email**: dr.mokira@gmail.com
- **GitHub**: [mokira3d48](https://github.com/mokira3d48)
- **GitLab**: [mokira3d48](https://gitlab.com/mokira3d48)