Replies: 4 comments 5 replies
-
@evgenyrud Hi. Afaik, Let me know if I have understood it incorrectly. Best |
Beta Was this translation helpful? Give feedback.
-
Is there some option on one request to proxy create several requests to backend server and then reply to client? |
Beta Was this translation helpful? Give feedback.
-
Hi, I need to store some key from upstream server reply and use it with each next http request to be sent to upstream server. I see that on every http request new plugin instance is created so neither static nor global plugin variable don't work for me. I'm implementing custom web server plugin. Thanks |
Beta Was this translation helpful? Give feedback.
-
Hi,
I thought about file as alternative.
Regarding global variable, where shall I define it? I tried to define it in
plugin class with default value None and set it in handle_route method and
then return reply to client. The next time when http request comes from
client I check the variable and it’s value is None.
Thanks,
Evgeny
…On Tue, 16 May 2023 at 9:34 Abhinav Singh ***@***.***> wrote:
1. You can certainly use global variables to share states between 2
instances of a plugin
2. But not, such global variables are not thread safe by default. You
must use thread safe data structure for this.
3. Alternately, you can also write a some file on disk (or redis,
memcache, some KV store) and have a lock around it for sharing data
—
Reply to this email directly, view it on GitHub
<#1332 (reply in thread)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AN7SR6TE33SMWGRZM2KDL3DXGMNW5ANCNFSM6AAAAAAXUEHBCI>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
Beta Was this translation helpful? Give feedback.
-
I need to implement forward proxy which receives http requests from existing client which can not change
Also upstream server might send http post/get messages back to client
Implemented ModifyPostDataPlugin and proxy.py routed request to upstream server and got reply back.
It works only with command like:
curl -v -x localhost:8899 http://127.0.0.1:8000/connect -d '{"key1": "value1", "key2": "value2"}'
But since my client doesn't know what is proxy server and can't be changed - my request should be like
curl -v -x http://127.0.0.1:8899/connect -d '{"key1": "value1", "key2": "value2"}' and this doesn't work.
and proxy should convert JSON and forward request to upstream server
How my goal can be achieved? tried to implement with different plugins but with no luck.
Please help
Thanks,
Evgeny
Beta Was this translation helpful? Give feedback.
All reactions