-
Notifications
You must be signed in to change notification settings - Fork 115
Open
Description
When I return a status code other than 200
, Nginx intercepts the request and show static nginx error file instead of my custom content generated in Ruby.
For example;
nginx.conf:
server {
location / {
mruby_content_handler "path/to/test.rb"; # or access_handler
}
}
test.rb:
class InvalidResponse
def call(env)
status = 404 # 404 File not Found.
hash = { success: false }
headers = {"Content-Type" => "application/json"}
body = [hash.to_json]
[status, headers, body]
end
end
run InvalidResponse.new
If I give 200
as a status
then {success: false}
shown on browser.
Isn't ngx_mruby capable of returning custom status codes with content?
P.S.: I also tried Nginx.return
and Nginx.status_code
. Neither worked.
Metadata
Metadata
Assignees
Labels
No labels