Comments (9)
@Fr3DBr BTW, a much more efficient way of delaying your upstream request is using ngx_lua's access_by_lua_block
directive:
location / {
access_by_lua_block { ngx.sleep(5) }
proxy_pass http://svr_backend;
include proxy.inc;
}
It's much much more efficient than your current echo_sleep
+ echo_location
combination, especially for large upstream responses.
from echo-nginx-module.
@Fr3DBr See
https://github.com/openresty/lua-nginx-module/#lua_check_client_abort
Read the document.
from echo-nginx-module.
@Fr3DBr BTW, you may find the lua-resty-limit-traffic library useful:
https://github.com/openresty/lua-resty-limit-traffic
It's shipped with OpenResty by default.
from echo-nginx-module.
@Fr3DBr In your case, the upstream request won't be sent until 5 sec is elapsed. Your web browser's "file being downloaded" is just its best guess and it's definitely untrue for your case here.
from echo-nginx-module.
BTW, sorry for the delay on my side.
from echo-nginx-module.
Hey @agentzh but, will this stop/pause any other requests while sleeping (parallelism) ?
from echo-nginx-module.
@Fr3DBr No, it's nonblocking. Read the documentation.
from echo-nginx-module.
@agentzh Ah, then this is fine, also do you have a way to detect in lua, if a connection was closed or not ? Or in case this is closed by the client, will it abort the current code execution just fine ?
from echo-nginx-module.
@agentzh Thank you very much. 👍
from echo-nginx-module.
Related Issues (20)
- multiple definition of `ngx_http_echo_exec_echo_end' HOT 1
- Trying to compile with Windows
- Bad homepage HOT 1
- Compatibility? HOT 3
- Returns an empty page
- echo_client_request_headers HTTP2 support
- How to build .so file from source code HOT 1
- Can you use it before try_files directive?
- how to install echo module on windows HOT 1
- echo_foreach_split join delimiter HOT 1
- how can I enable this module in a alpine docker container HOT 1
- When I installed it and it didn't work HOT 1
- I don't seem to be able to do that either. HOT 1
- Please add instructions for including this module with a dockerfile HOT 1
- Error running the tests on ppc64le
- Problem with $request_body
- Failed to load HOT 2
- content_handler should work also on TLS webserver
- util/releng matches .gitignore
- NMAKE don't know how to make ddebug
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from echo-nginx-module.