Giter Club home page Giter Club logo

haproxy-error-page's People

Contributors

pursultani avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

haproxy-error-page's Issues

Lua function 'error-page': runtime error

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.

Add txn:done() !

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.