Im trying to connect my nginx proxy_pass to my aiohttp web server
But im keep getting errors
server {
server_name pyband.ir;
location /bot {
proxy_pass https://127.0.0.1:5000;
}
location /nextpay {
proxy_set_header Host $http_host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_redirect off;
proxy_buffering off;
proxy_pass https://127.0.0.1:5001;
}
}
here is my nginx config
and here is my code :
from aiohttp import web
from aiohttp.web_request import Request
WEB_SERVER_HOST = "127.0.0.1"
WEB_SERVER_PORT = 5001
Router = web.RouteTableDef()
@Router.get('/nextpay')
async def verify(request: Request):
print(type(request))
return web.Response(text="Hello, world")
def main():
app = web.Application()
app.add_routes(Router)
web.run_app(app, host=WEB_SERVER_HOST, port=WEB_SERVER_PORT)
if __name__ == "__main__":
main()
and this is the error im keep getting every time i request on /nextpay :
aiohttp.http_exceptions.BadStatusLine: 400, message="Bad status line 'invalid HTTP method'"