mirror of
https://github.com/fatedier/frp.git
synced 2026-05-15 16:15:49 -06:00
[GH-ISSUE #2219] Using server plug-in to communicate with Flask app #1766
Labels
No labels
In Progress
WIP
WaitingForInfo
bug
doc
duplicate
easy
enhancement
future
help wanted
invalid
lifecycle/stale
need-issue-template
need-usage-help
no plan
proposal
pull-request
question
todo
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: github-starred/frp#1766
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @charlee-cz on GitHub (Jan 25, 2021).
Original GitHub issue: https://github.com/fatedier/frp/issues/2219
[REQUIRED] hat version of frp are you using
Version: 0.34.3 for both client and server
[REQUIRED] What operating system and processor architecture are you using
OS: Ubuntu 20.04.1 LTS (server), Raspberry Pi on Raspberry Pi OS (client)
CPU architecture:
[REQUIRED] description of errors
confile
log file
Steps to reproduce the issue
./frpswith the init above./frpcon another machine with the init specified aboveSupplementary information
My Flask app currently checks the request for
['op']then matches a function based on what operation is sent. Each function currently returns a JSON converted dictionary forallowwithout modfication as specified in your documentation. So:Currently it seems like NewProxy runs into a bug in returning the response. I am able to get the request:
But then I encounter the
proxy name [] is already in useerror even though I have my Flask app return theunchange: trueJSON response. I have it manually set to always return that string with a 200 HTTP code.I am also never getting responses for NewWorkConn on the Flask side. Maybe I'm understanding the documentation wrong but I was under the assumption this is triggered when
frpcconnects tofrps.My rationale: I want to be able to let
frpcconnect to random remote ports for tcp viaremote_port: 0, and have thefrpsserver find out what port it ends up being without the use of the admin portal or without having to manually gain access to thefrpcmachine (as I want to be able to manage this automatically). As of now, it doesn't seem like theNewProxyoperation automatically tells me what port it is, but I was thinking that I could just have this be handled on the Flask side if needed be (haven't been able to get it to work, so just wanted to fix this bug before trying that).If there is a much simpler way to handle this, I would much appreciate help on that end.
Can you guess what caused this issue
Maybe I'm understanding the plug-in wrong and making mistakes in my Flask app (not quite experienced in writing server endpoints), but not sure what is causing the issue.
Checklist:
@charlee-cz commented on GitHub (Jan 26, 2021):
Another quick question:
when frpc uses
remote_port:0, the JSON string sent through the server plug-in also sendsremote_port:0. Is there a way to get the actual port being used?@fatedier commented on GitHub (Jan 27, 2021):
@CharLee674
You can assign the port in your plugin, or get this port from frps HTTP API after the proxy started.
@charlee-cz commented on GitHub (Jan 27, 2021):
Oh ok thanks! Not sure why I didn't try the second option first. Is there documentation on the HTTP API endpoints? I know I can figure it out myself but just wondering.
@fatedier commented on GitHub (Jan 28, 2021):
@CharLee674 No documents for that now. It's only used in frp dashboard and not elegant. We want to refeactor it future.
@yuyulei commented on GitHub (Feb 5, 2021):
@CharLee674 I tested as you said, but failed to reproduce it.
I found 2 proxies(35a8438f7701e96f, 06c235b24453dbef) in your log, they have same proxy name ?
@charlee-cz commented on GitHub (Feb 5, 2021):
Sorry for forgetting to update, but I did try an alternate flask app and it seemed to work fine there. Most likely an issue on my end. I'll close this issue now