Closed kocane closed 2 years ago
Change this lines of app.py: 28 print(f"Sending golden hen to {request.remote_addr}") 29 send(request.remote_addr, 9020, "payload/goldhen_2.0b_900.bin")
to
28 print(f"Sending golden hen to
The problem is that this script uses the IP that conects to it, as you´re behind an reverse proxy, the script sees the IP os the proxy, not of the client.
As @pabloalcantara says, it's due to sending the payload to the source IP - if you can confirm his fix works, then I could consider adding a check for an environment variable to work in this scenario
It works, I use the python docker container to use this solution on my server.
docker-compose.yaml:
PS4Jailbreak: image: "python:3" container_name: PS4Jailbreak ports:
/entrypoint.sh
cd /ps4/pspack-flask-main sed -i "s/{request.remote_addr}/192.168.25.176/g" app.py sed -i 's/request.remote_addr/"192.168.25.176"/g' app.py python -m pip install -r requirements.txt python app.py
It works, I use the python docker container to use this solution on my server.
Could you share your nginx config?
I use NPM (https://nginxproxymanager.com/) so I don´t have the config. But I believe that if the machine running this script can access the IP of the PS4, everything must works with the basic nginx config.
Do you mind testing with the dockerfile I just merged? (Obviously adding your sed commands) just to check the existing file works. Following that I'll add a check, thanks!
Yes, the build and execution works.
Sorry, it works, but still need to edit the app.py to use the PS4 Ip, as the container only sees the internal docker proxy IP, not the real IP client. I think that ambient variable will resolve this.
In my nginx config I use this, which should forward the client ip adress
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-Proto https;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header X-Forwarded-Host $remote_addr;
But I think that Flask/Python ignores it, but I don't know much about it. Perhaps the replies in this discussion makes sense for you, @mc-17?
Thanks, hope to get to this after Christmas, I'll make a branch with the changes if you wouldn't mind just confirming it works
Thanks, hope to get to this after Christmas, I'll make a branch with the changes if you wouldn't mind just confirming it works
Thanks to you as well. I'll test it when you got something. Merry Christmas!
Merry Christmas!
I've dropped a branch here, if you modify Dockerfile
and set the IP, does it work? https://github.com/mc-17/pspack-flask/tree/feature/reverse-proxy
@mc-17 Which IP is it that I should input in CONSOLE_IP?
The Ps4 IP address
Em seg., 27 de dez. de 2021 19:00, kocane @.***> escreveu:
@mc-17 https://github.com/mc-17 Which IP is it that I should input in CONSOLE_IP?
— Reply to this email directly, view it on GitHub https://github.com/mc-17/pspack-flask/issues/6#issuecomment-1001775649, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAHBTSAFKJR2A4XUM4TTJZDUTDOZFANCNFSM5KQRSM2A . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.
You are receiving this because you were mentioned.Message ID: @.***>
I'm a bit confused. The WAN IP of the PS4, or? I'm hosting the app on a remote server. Ideally it shouldn't be locked to a specific server.
I think this is for local Server, not remote Server.
Em qui., 30 de dez. de 2021 07:57, kocane @.***> escreveu:
I'm a bit confused. The WAN IP of the PS4, or? I'm hosting the app on a remote server. Ideally it shouldn't be locked to a specific server.
— Reply to this email directly, view it on GitHub https://github.com/mc-17/pspack-flask/issues/6#issuecomment-1002976428, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAHBTSDKDKT2F4LIFKBDUU3UTQ3KHANCNFSM5KQRSM2A . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.
You are receiving this because you were mentioned.Message ID: @.***>
I'm not really sure of your use case, but you said that the IP that requests the page is wrong, so I thought a reasonable environment name was CONSOLEIP
. If it's meant to be a different IP then I can rename it. If a single IP is too limiting, and you know of a solution, then happy to accept PRs - I'm not a networking guy.
Closed due to inaction
Thanks for the work! Any idea what it would take to serve it thru a reverse proxy with nginx?
I tried with a "normal" reverse proxy but it fails in sending the file.