Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: forward-auth request body is too large #10425

Closed
wants to merge 15 commits into from
Closed

fix: forward-auth request body is too large #10425

wants to merge 15 commits into from

Conversation

lplcc
Copy link

@lplcc lplcc commented Oct 31, 2023

Description

The gateway returns 403 forbidden in the forward-auth.lua file because the post request body is too large

Fixes #10375

Checklist

  • I have explained the need for this PR and the problem it solves
  • I have explained the changes or the new features added to this PR
  • I have added tests corresponding to this change
  • I have updated the documentation to reflect this change
  • I have verified that this change is backward compatible (If not, please discuss on the APISIX mailing list first)

@Revolyssup
Copy link
Contributor

THis is recreation of this PR https://github.com/apache/apisix/pull/10377/files trying to solve #10375

@lplcc
Copy link
Author

lplcc commented Oct 31, 2023

but I can't solve this error “ [error] 98340#98340: *40 [lua] init.lua:551: handle_upstream(): failed to set upstream: missing upstream configuration in Route or Service”,
I just added two lines of code in the forward-auth.lua file

@monkeyDluffy6017
Copy link
Contributor

I will close this pr first, let's discuss this in the issue

@monkeyDluffy6017
Copy link
Contributor

Please make the ci pass

@monkeyDluffy6017 monkeyDluffy6017 added wait for update wait for the author's response in this issue/PR need test cases labels Nov 20, 2023
@shreemaan-abhishek shreemaan-abhishek changed the title fix:Solve the 403 problem caused by the post request body is too large fix: forward-auth request body is too large Nov 21, 2023
@shreemaan-abhishek
Copy link
Contributor

I am checking this, the current fix is causing some other failures that need to be fixed first.

@monkeyDluffy6017
Copy link
Contributor

@shreemaan-abhishek is this pr ready?

@shreemaan-abhishek
Copy link
Contributor

@monkeyDluffy6017 yes.

end
}
}
--- error_code: 200
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you test the response body or the response header too?

@monkeyDluffy6017
Copy link
Contributor

@shreemaan-abhishek please fix the code lint error

Copy link
Member

@Gallardot Gallardot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

}
)

ngx.say(res.body)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

2023/12/01 17:40:30 [warn] 92639#13489089: *46 a client request body is buffered to a temporary file /Users/guohao/workspace/apisix/t/servroot/client_body_temp/0000000001, client: 127.0.0.1, server: localhost, request: "POST /auth HTTP/1.1", host: "127.0.0.1:1984"
2023/12/01 17:40:30 [info] 92639#13489089: *46 [lua] request.lua:302: get_body(): attempt to read body from file: /Users/guohao/workspace/apisix/t/servroot/client_body_temp/0000000001, client: 127.0.0.1, server: localhost, request: "POST /auth HTTP/1.1", host: "127.0.0.1:1984"
2023/12/01 17:40:30 [warn] 92639#13489089: *42 [lua] plugin.lua:1159: run_plugin(): forward-auth exits with http status code 400, client: 127.0.0.1, server: localhost, request: "POST /large-body HTTP/1.1", host: "127.0.0.1:1984"
2023/12/01 17:40:30 [warn] 92639#13489089: *3 using uninitialized "upstream_scheme" variable while logging request, client: 127.0.0.1, server: localhost, request: "GET /t HTTP/1.1", host: "localhost"

@monkeyDluffy6017
Copy link
Contributor

It's fixed by #10589

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
wait for update wait for the author's response in this issue/PR
Projects
None yet
Development

Successfully merging this pull request may close these issues.

bug: When the request body is too large, forward-auth returns 403
6 participants