pursultani / haproxy-error-page Goto Github PK
View Code? Open in Web Editor NEWA Lua script for handling HTTP error pages in HAProxy
License: Other
A Lua script for handling HTTP error pages in HAProxy
License: Other
Hello my friend!
I'm trying to run this project, but i always got the error (when it's match the error code):
proxy_1 | 00000005:http.clireq[0008:ffffffff]: GET /test HTTP/1.1
proxy_1 | 00000005:http.clihdr[0008:ffffffff]: Host: localhost:8080
proxy_1 | 00000005:http.clihdr[0008:ffffffff]: User-Agent: curl/7.61.1
proxy_1 | 00000005:http.clihdr[0008:ffffffff]: Accept: /
proxy_1 | [debug] 008/110813 (11) : lua.error-page: rewrite error page: 404
proxy_1 | [ALERT] 008/110813 (11) : Lua function 'error-page': runtime error: 0 from [C] method 'set', /usr/local/etc/haproxy/scripts/error-page.lua:101 C function line 96.
proxy_1 | 00000005:web.srvrep[0008:adfd]: HTTP/1.1 404 Not Found
proxy_1 | 00000005:web.srvhdr[0008:adfd]: Server: nginx/1.15.8
proxy_1 | 00000005:web.srvhdr[0008:adfd]: Date: Wed, 09 Jan 2019 11:08:13 GMT
proxy_1 | 00000005:web.srvhdr[0008:adfd]: Content-Type: text/html
proxy_1 | 00000005:web.srvhdr[0008:adfd]: Content-Length: 153
proxy_1 | 00000005:web.srvhdr[0008:adfd]: Connection: close
Can you help me?
Thanks.
I'm getting a plain text response error page, is there any way to add a Content-Type Header text/html ?
Hi there,
many thanks for your script, it saved (and crashed ;-) ) my day.
I realized that the error-responses contain parts of parallel responses sometimes and found out, that you need to add txn:done() at the end of your script.
Otherwise your script is not thread-/transaction-safe.
core.register_action("error-page", { "http-res" }, function(txn)
local error_code = txn.sf:status()
local error_page = error_pages[error_code]
if error_page ~= nil then
txn:Debug("lua.error-page: rewrite error page: " .. error_code)
txn.res:set("")
txn.res:send(error_page)
txn:done()
end
end)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.