drakkan / sftpgo

Full-featured and highly configurable SFTP, HTTP/S, FTP/S and WebDAV server - S3, Google Cloud Storage, Azure Blob
https://sftpgo.com
GNU Affero General Public License v3.0
9.12k stars 713 forks source link

🐛 max_upload_file_size being ignored for HTTPD #1210

Closed AlejandroUPC closed 1 year ago

AlejandroUPC commented 1 year ago

EDIT: Look at the bottom for the possible reason

When the server is running with the following config:

Version : 2.4.4 - dev Image: Alpine Expected Behavior: When setting the max_upload_file_size to 0 as expected in the documentation files should be able to upload files of any size according to this. The logs of the loaded config are uploaded to validate that the configuration is being parsed correctly. Behavior: As soon as the user clicks on upload the server returns a 413 error (entity too large), see screenshot. Some points:

{"level":"info","time":"2023-02-26T22:50:43.069","sender":"httpd","message":"initializing HTTP server with config {Bindings:[{Address:0.0.0.0 Port:8080 EnableWebAdmin:true EnableWebClient:true EnableRESTAPI:true EnabledLoginMethods:0 EnableHTTPS:false CertificateFile: CertificateKeyFile: MinTLSVersion:12 ClientAuthType:0 TLSCipherSuites:[] ProxyAllowed:[] ClientIPProxyHeader: ClientIPHeaderDepth:0 HideLoginURL:0 RenderOpenAPI:true WebClientIntegrations:[] OIDC:{ClientID: ClientSecret: ConfigURL: RedirectBaseURL: UsernameField: RoleField: ImplicitRoles:false Scopes:[openid profile email] CustomFields:[] InsecureSkipSignatureCheck:false Debug:false provider:<nil> verifier:<nil> providerLogoutURL: oauth2Config:<nil>} Security:{Enabled:false AllowedHosts:[] AllowedHostsAreRegex:false HostsProxyHeaders:[] HTTPSRedirect:false HTTPSHost: HTTPSProxyHeaders:[] STSSeconds:0 STSIncludeSubdomains:false STSPreload:false ContentTypeNosniff:false ContentSecurityPolicy: PermissionsPolicy: CrossOriginOpenerPolicy: ExpectCTHeader: proxyHeaders:[]} Branding:{WebAdmin:{Name: ShortName: LogoPath: LoginImagePath: FaviconPath: DisclaimerName: DisclaimerPath: DefaultCSS: ExtraCSS:[]} WebClient:{Name:ShortName:LogoPath: LoginImagePath: FaviconPath: DisclaimerName: DisclaimerPath: DefaultCSS: ExtraCSS:[]}} allowHeadersFrom:[]} {Address: Port:0 EnableWebAdmin:false EnableWebClient:false EnableRESTAPI:false EnabledLoginMethods:0 EnableHTTPS:false CertificateFile: CertificateKeyFile: MinTLSVersion:0 ClientAuthType:0 TLSCipherSuites:[] ProxyAllowed:[] ClientIPProxyHeader: ClientIPHeaderDepth:0 HideLoginURL:2 RenderOpenAPI:false WebClientIntegrations:[] OIDC:{ClientID: ClientSecret: ConfigURL: RedirectBaseURL: UsernameField: RoleField: ImplicitRoles:false Scopes:[] CustomFields:[] InsecureSkipSignatureCheck:false Debug:false provider:<nil> verifier:<nil> providerLogoutURL: oauth2Config:<nil>} Security:{Enabled:false AllowedHosts:[] AllowedHostsAreRegex:false HostsProxyHeaders:[] HTTPSRedirect:false HTTPSHost: HTTPSProxyHeaders:[] STSSeconds:0 STSIncludeSubdomains:false STSPreload:false ContentTypeNosniff:false ContentSecurityPolicy: PermissionsPolicy: CrossOriginOpenerPolicy: ExpectCTHeader: proxyHeaders:[]} Branding:{WebAdmin:{Name: ShortName: LogoPath: LoginImagePath: FaviconPath: DisclaimerName: DisclaimerPath: DefaultCSS: ExtraCSS:[]} WebClient:{Name: ShortName: LogoPath: LoginImagePath: FaviconPath: DisclaimerName: DisclaimerPath: DefaultCSS: ExtraCSS:[]}} allowHeadersFrom:[]}] TemplatesPath:templates StaticFilesPath:static OpenAPIPath:openapi WebRoot: CertificateFile: CertificateKeyFile: CACertificates:[] CARevocationLists:[] SigningPassphrase: TokenValidation:0 MaxUploadFileSize:0 Cors:{AllowedOrigins:[] AllowedMethods:[] AllowedHeaders:[] ExposedHeaders:[] AllowCredentials:false Enabled:false MaxAge:0 OptionsPassthrough:false OptionsSuccessStatus:0 AllowPrivateNetwork:false} Setup:{InstallationCode: InstallationCodeHint:Installation code} HideSupportLink:false}"}

The browser inspector error (again, no logs on server):

image

Error description on the client:

image

Server logs when the error appears:

{"level":"info","time":"2023-02-26T23:49:00.732","sender":"httpd","local_addr":"*****:8080","method":"GET","proto":"HTTP/1.1","remote_addr":"10.103.170.48:45852","request_id":"64187fe39aa3383fe9c8fca7cb6aa518","uri":"http://*****/web/client/profile","user_agent":"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/110.0.0.0 Safari/537.36","resp_status":302,"resp_size":40,"elapsed_ms":0} {"level":"info","time":"2023-02-26T23:49:01.132","sender":"httpd","local_addr":"*****:8080","method":"GET","proto":"HTTP/1.1","remote_addr":"10.103.170.48:45852","request_id":"e2aa2b15835ca92ae1a69105622ce170","uri":"http://****/web/client/login","user_agent":"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/110.0.0.0 Safari/537.36","resp_status":200,"resp_size":5538,"elapsed_ms":0}

Possible reason: When playing around and hosting the instance under a DNS this is failing when forwarding the connection (through a VPN), as if it was running locally its working.

Solution was an ingress-nginx issue w/ file size limits, feel free to delete the issue or close it incase somebody gets also a similar problem

drakkan commented 1 year ago

Hello,

if this is rejected by SFTPGo you should get this error

Schermata del 2023-02-27 09-42-18

I think the error you reported unrelated to SFTPGo