I am using reverse proxy to open the domain without reserved port
import os
import dotenv
import uvicorn
from fastapi import FastAPI, Request
from fastapi.responses import Response
app = FastAPI()
# Backend service URL
BACKEND_URL = ""
@app.api_route("/{path:path}", methods=["GET", "POST", "PUT", "DELETE", "OPTIONS"])
async def reverse_proxy(path: str, request: Request):
async with httpx.AsyncClient() as client:
target_url = f"{BACKEND_URL}/{path}"
headers = dict(request.headers)
body = await request.body()
response = await client.request(
method=request.method, url=target_url, headers=headers, content=body
)
return Response(content=response.content, status_code=response.status_code, headers=dict(response.headers))
if __name__ == "__main__":
uvicorn.run("proxy:app", host="0.0.0.0", port=80)
But I am still getting this error
[digibazaar@s3]:<~>$ cd duckai
[digibazaar@s3]:<~/duckai>$ ls
__pycache__ LICENSE proxy.py
duckassist.py main.py requirements.txt
[digibazaar@s3]:<~/duckai>$ python3 -m proxy
INFO: Started server process [66901]
INFO: Waiting for application startup.
INFO: Application startup complete.
ERROR: [Errno 1] error while attempting to bind on address ('0.0.0.0', 80): operation not permitted
INFO: Waiting for application shutdown.
INFO: Application shutdown complete.