Apache error 413 Payload Too Large with mod_security

Solution Verified - Updated -

Issue

The 413 Payload Too Large error in Apache with mod_security often happens in two places:

  • Publishing a content view with large repositories fails with below error:

    RestClient::PayloadTooLarge: 413 Payload Too Large
    
    Backtrace:
    
    /opt/theforeman/tfm/root/usr/share/gems/gems/rest-client-2.0.1/lib/restclient/abstract_response.rb:223:in `exception_with_response'
    /opt/theforeman/tfm/root/usr/share/gems/gems/rest-client-2.0.1/lib/restclient/abstract_response.rb:103:in `return!'
    /opt/theforeman/tfm/root/usr/share/gems/gems/runcible-2.8.1/lib/runcible/base.rb:93:in `block in get_response'
    /opt/theforeman/tfm/root/usr/share/gems/gems/rest-client-2.0.1/lib/restclient/request.rb:807:in `process_result'
    
  • Package profile upload task fails on the hosts:

Traceback (most recent call last):
  File "/usr/lib64/python3.6/site-packages/subscription_manager/cache.py", line 176, in update_check
    self._sync_with_server(uep, consumer_uuid)
  File "/usr/lib64/python3.6/site-packages/subscription_manager/cache.py", line 515, in _sync_with_server
    _combined_profile
  File "/usr/lib64/python3.6/site-packages/rhsm/connection.py", line 1280, in updateCombinedProfile
    return self.conn.request_put(method, profile)
  File "/usr/lib64/python3.6/site-packages/rhsm/connection.py", line 915, in request_put
    return self._request("PUT", method, params, headers=headers)
  File "/usr/lib64/python3.6/site-packages/rhsm/connection.py", line 932, in _request
    info=info, headers=headers, cert_key_pairs=cert_key_pairs)
  File "/usr/lib64/python3.6/site-packages/rhsm/connection.py", line 791, in _request
    self.validateResponse(result, request_type, handler)
  File "/usr/lib64/python3.6/site-packages/rhsm/connection.py", line 879, in validateResponse
    handler=handler)
rhsm.connection.ForbiddenException: Server error attempting a PUT to /rhsm/consumers/xxx/profiles returned status 403

and the matching error in the httpd error log on Satellite:

413 Payload Too Large: <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
 <html><head>
 <title>413 Request Entity Too Large</title>
 </head><body>
 <h1>Request Entity Too Large</h1>
 The requested resource<br />/pulp/api/v2/consumers/xxxx/profiles/<br />
 does not allow request data with POST requests, or the amount of data provided in
 the request exceeds the capacity limit.
 </body></html>

Environment

  • Red Hat Satellite 6.x

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.

Current Customers and Partners

Log in for full access

Log In

New to Red Hat?

Learn more about Red Hat subscriptions

Using a Red Hat product through a public cloud?

How to access this content