Halloween DealsAmazon USHalloween week deals: useful picks before month-endAmazon US: current deals, useful picks and tech finds.Check DealsSlow PC?RecommendedPC slow today? Run a repair scan before it gets worseResolve common Windows issues and optimize system performance.Scan NowHalloween DealsAmazon USOctober picks are moving - compare before checkoutAmazon US: current deals, useful picks and tech finds.See Picks×
FREEDOM251

Freedom251 › Blog › API configuration

How to Configure Nginx to Accept PUT Requests

By Freedom251 Team · · 11 min read

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

NGINX can accept a PUT request in two fundamentally different ways: it can write the request body to the filesystem through its WebDAV module, or it can proxy the request to an application that owns storage and validation. Choose the design first. A 405 response usually means the request reached a location that does not permit PUT, the WebDAV module is unavailable, or an upstream application rejected the method—not that PUT is impossible in NGINX.

Choose who owns the PUT operation

HTTP PUT generally means “store this representation at this resource,” but the component that performs the storage can be NGINX or your application. That choice determines the configuration, security model, error handling and operational risk.

As an Amazon Associate I earn from qualifying purchases.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Direct filesystem writes with WebDAV

Use NGINX’s ngx_http_dav_module when the endpoint is a controlled file drop and the URL maps directly to a path on disk. NGINX receives the body, creates or replaces the target file and applies the configured filesystem permissions. This is appropriate for a tightly controlled upload area, internal file exchange or a simple WebDAV-style service.

The module processes PUT, DELETE, MKCOL, COPY and MOVE. It is not built by default, so the NGINX binary must have been compiled with --with-http_dav_module. A direct DAV endpoint does not give you application-level rules such as business validation, object version checks or domain-specific conflict handling.

#1 Best Overall
Sale
TOZO A1 Wireless Earbuds Bluetooth 5.3 Light Weight in Ear Headphones | IPX5 Waterproof,2 Mics for AI Calls,Immersive Premium Sound Bass Headset with Charging Case,32 EQ via App Black
  • [Ultra-Lightweight Ear Buds Designed for Small Ears] Each earbud weighs only 3.7g and features a compact, ergonomic in-ear design made especially for small ears. Secure, low-profile, and comfortable for workouts, all-day wear or overnight sleeping.The ultra-slim profile sits flush in your ear with no hard edges poking or rubbing, so you can even sleep on your side without discomfort.
  • [Immersive Stereo Sound with TOZO OrigX Technology] TOZO OrigX tuning delivers clear vocals, balanced mids, and natural stereo sound for music, podcasts, and videos.
  • [Long Battery Life for Daily Use] Get up to 7 hours of playtime on a single charge, with up to 32 hours total using the charging case—ideal for workdays, commuting, and extended listening sessions.
  • [Bluetooth 5.3 & Stable Connection] Bluetooth 5.3 provides fast pairing, stable wireless performance, and reduced dropouts as you move around home or office.
  • [Deep Bass with Clear Vocals] High-performance drivers produce punchy bass while keeping vocals clean and detailed for everyday listening.

Proxying PUT to an application

Use a reverse-proxy location when PUT represents an API resource such as /items/42. Your application can then authenticate the caller, validate the representation, decide whether replacement is allowed, enforce ETags or version conflicts, and select the storage backend. NGINX remains responsible for routing and transport rather than becoming the data store.

Decision point Direct DAV write Application proxy
Storage owner NGINX writes a path under the configured document root. The upstream application chooses its filesystem, database or object storage.
Validation and authorization Mostly NGINX access rules plus filesystem permissions; application semantics are limited. Application code can validate content, identity, ownership and state transitions.
Filesystem exposure NGINX worker account needs write access to the upload tree. NGINX does not need to expose the application’s storage path.
Resource semantics File creation and replacement are the primary operations. ETags, version conflicts, partial updates and domain rules can be implemented upstream.
Operational risk Simple for a private, dedicated drop zone, but a bad path or permission can overwrite files. More moving parts, but authorization and conflict handling remain in the service designed for them.

Do not combine both designs accidentally. A broad filesystem location can capture a URL intended for your API, while a proxy location can send a file upload to an upstream that was never designed to receive it.

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

What NGINX must do before PUT can work

NGINX does not need a special global “enable PUT” switch. A request is accepted when the selected location has a handler for it and no access-control rule or upstream policy rejects it.

  • For direct writes, the binary must include ngx_http_dav_module, and the selected location must include dav_methods PUT (or a broader DAV method list).
  • For a proxied API, the selected location needs proxy_pass. PUT is forwarded like other HTTP methods unless another directive or the upstream rejects it.
  • The request must reach the intended location. A different prefix or regular-expression location can produce a 405 or route the request somewhere else.
  • Access rules, authentication and the application itself can still deny the request after NGINX has recognized the method.

A 405 response therefore identifies a method-policy problem at some layer, not necessarily an NGINX syntax error. Check which server block and location handled the request before changing directives.

Configure NGINX to write PUT bodies directly

1. Verify that the DAV module is present

Run nginx -V on the binary that will serve the endpoint and inspect the configure arguments for --with-http_dav_module. If it is absent, install or build an NGINX package that includes the module, then validate the replacement configuration before reloading. A location containing dav_methods cannot provide direct PUT storage when the module is missing.

2. Prepare a dedicated upload tree

Keep writable content outside locations that serve your application code, configuration or private data. In the example below, URLs beginning with /uploads/ map below /data/www. The NGINX worker account must be able to create and modify files in the resulting directory. The temporary body directory must also be writable by that account.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #2
Sale
Smart Watch for Men Women Compatible with iPhone Samsung Android Phone 1.69 inch Full Touch Screen IP68 Waterproof Bluetooh Fitness Tracker Heart Rate/Sleep Monitor (Black)
  • 【IP68 Waterproof Multifunctinal Smart Watch】Torjalph fitness activity tracker smart watch is IP68 waterproof technology ,you can wear it when swimming,handwashing,it's rain-proof which means that you perform multiple exercise modes outside without worrying about sweat or rain corroding your fitness smart watch,and this watch equipped with a 230 mAh large capacity battery magnetic charging ,and this sports activity tracker watch can be used 5-7 days If fully charged.
  • 【Larger 1.83'' Full Screen Watch & Multi-dial Selection】1.83 inch full HD color touch screen smart watch for men / women provides excellent 240*284 resolution image quality ,This Bluetooth smart watch offers a better touch experience and remarkable immersion and ,more than 200 watch faces for you to choose from App"Da Fit ", you can change the dial style according to your mood to wear keeping the world on your wrist
  • 【Accurate Activity Tracker Smart Watch 】sports watch activity tracker uses sweat and dust resistant breathable silicone strap, our Fitness Tracker Smart Watch for Android iOS Phones supports 12 sports modes,walking,running,bicycle,swimming,badminton,basketball,football,rope skipping. This bluetooth calls smart watch for men women is lightweight and stylish, bringing more convenient and relaxing sports experience while also providing more protection.
  • 【Your 24 Hour Personal Daily Health Monitor】Fitness watch for women men full touch screen IP67 waterproof bluetooth smartwatch for Android iOS Phones with heart rate blood pressure monitor multifunction Andriod smart watch with steps counter sleep monitor sports fitness watch, monitoring blood oxygen saturation allows you to understand your physical condition in real time to track fitness progress ,to know your health status in time.
  • 【More Functions Bluetooth Call Smart Watch】This fitness activity smart watch full screen for iPhone and Android phones includes a bunch of new features including:The bluetooth smart watch can hang up the phone, receive and display WhatsAPP /Text /Facebook /Twitter /Messenger reminder.Support sedentary reminder, alarm clock, stopwatch, timer,weather information,music control, remote camera control compatible with Android 5.0 and above or iOS 9.0 and above smartphones.

3. Add a PUT-enabled location

location /uploads/ {
    root /data/www;
    client_body_temp_path /data/client_temp;
    dav_methods PUT;
    create_full_put_path on;
    dav_access user:rw group:rw all:r;

    limit_except GET {
        allow 192.168.1.0/32;
        deny all;
    }
}

root /data/www maps a request such as /uploads/photo.jpg to a path below that root. client_body_temp_path tells NGINX where to buffer request bodies while processing them. The directory must exist and match the worker account’s permissions.

dav_methods PUT enables only PUT in this location. If you need WebDAV operations, you can list PUT DELETE MKCOL COPY MOVE, but every additional method increases the write surface and should be enabled only when required.

create_full_put_path on creates missing intermediate directories. Its default is off, so a PUT to a new nested path can fail unless the directories already exist or this directive is enabled. Directory creation still depends on ordinary operating-system permissions.

dav_access sets permissions for newly created files and directories. The exact owner, group and mode should match your deployment’s filesystem policy. Existing files retain their existing permissions; changing this directive is not a substitute for auditing the upload tree.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

4. Validate and reload safely

  1. Check the complete configuration with nginx -t.
  2. Reload the service using your operating system’s normal NGINX reload mechanism so existing connections are handled gracefully.
  3. Send a PUT to a disposable path, not a production file, and verify both the HTTP response and the resulting file owner, mode and contents.

A simple controlled test is:

printf 'test payloadn' > /tmp/put-test.txt
curl --request PUT --upload-file /tmp/put-test.txt http://server.example/uploads/put-test.txt

Use an address and credentials that satisfy the location’s access rules. Confirm that the target file contains exactly the test payload, then remove it. The response status should be interpreted together with the access and error logs; a successful transfer does not prove that the intended location handled the request.

Proxy PUT requests to an application

1. Create a location for the API

location /api/ {
    proxy_pass http://backend;
    proxy_set_header Host $host;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header X-Forwarded-Proto $scheme;
}

The reverse-proxy guide supports forwarding requests to another HTTP server, including an application built with a framework such as Python or PHP. The proxy module’s proxy_pass directive is valid in a location context, as shown above.

Rank #3
New Bee Guitar Cable 10ft Electric Instrument Bass AMP Cord | 6.35mm Jack, Durable Design, Stage and Home Studio Use, Low Noise Shielded Electric Cord for Bass, Keyboard, Amp, Mixer
  • [Low Noise High Fidelity] New bee guitar cord with 22AWG oxygen-free-copper center conductors provides enhanced signal transfer, the PVC insulation material and the high-density stranded copper double shield provide noise rejection for quiet operation
  • [Ideal for Choice] New bee 1/4 straight and right angle metal connectors, ensures a secure connection in any instrument, pedal, or amp jack. L shape great fro on stage guitar stands
  • [Wide Compatible] Suitable for mixer, power amplifier, microphone, effector, decoder, equalizer, electoronic organ, electric guitar, electric bass and other electronic equipments. Widely used in the installation of smart home, karaoke speaker, professional stage audio, etc
  • [Easy Disassemble] Making incidental repairs quick and easy! Very nice, flexible cable
  • [Dont Hesite to Order] 24 hours customer services and professional technology team are standing by

proxy_pass_request_body defaults to on, and proxy_pass_request_headers also defaults to on. Consequently, a normal PUT body and its headers are sent upstream unless your configuration explicitly disables either directive. If the body or headers are disabled, the application can receive an incomplete request and return an apparently unrelated validation or method error.

2. Check the URI mapping deliberately

The URI part of proxy_pass changes how NGINX constructs the upstream path. With proxy_pass http://backend/remote/; inside location /name/, NGINX replaces the normalized /name/ prefix with /remote/. Thus a request for /name/item/42 is sent with the corresponding /remote/item/42 path.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

With proxy_pass http://backend; and no URI, NGINX forwards the original or full normalized request URI according to its documented processing rules. For the example configuration, test /api/items/42 and inspect the application log or request trace to confirm that the upstream receives the path your router expects. A path mismatch can look like a PUT rejection when the request actually reached a different endpoint.

3. Let the application own resource rules

The upstream should decide whether the caller may replace the selected resource, whether the representation is valid and whether a conflict must be reported. If the API uses ETags, revision numbers or idempotency rules, preserve the relevant request headers and make the application’s response status visible to the client. NGINX accepting the HTTP method does not make an invalid or unauthorized resource update successful.

Test with a disposable resource and a representative body:

curl --request PUT 
     --header 'Content-Type: application/json' 
     --data '{"name":"example"}' 
     http://server.example/api/items/42

Check the upstream log for the method, path, headers and body length. Then verify the application’s own result rather than relying only on NGINX’s access-log status.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #4
BSIMB 15.6" Digital Family Calendar & Chore Chart, No Subscription Fees
  • Digital Family Calendar: BSIMB digital calendar wall touch screen puts an end to your chaotic life. Designed for busy families, the digital calendar keeps you organised and in step with your family. Assign different colours and tasks to each family member to make family scheduling easier and more intuitive.
  • Easy Setup and Auto-Sync: Plug in, connect to WLAN and auto-syn your electric calendar in minutes. Digital wall calendar compatible with Google calendar, iCloud calendar, Outlook calendar, Cozi calendar and Yahoo calendar. Add events directly on the device or through the ecalendar app. Electronic calendar stays current whether you're at work or traveling—no manual updates needed.
  • All-In-One Home Assistant: Smart calendar builds habits and encourage independence with personalised chores. Display daily meal plan to reduce the daily ‘What's for dinner?’ stress. To-do lists keep track of everything you want. Turning chores into valuable achievements with stars and rewards, making life easier and more enjoyable.
  • Manage Anytime Anywhere: BSIMB electronic calendar for family stay connected with the powerful ecalendar app. Access and manage your digital wall calendar anytime, anywhere with free features like stars & rewards, photo screensaver, chore charts, meals plans, to-do lists etc. Electronic planner paid features like Magic Import tailor advanced tools for users with special needs.
  • Stay in Touch with Loved Ones: Share photos or videos from your phone to electronic wall calendar with app, instantly update your life moment, and keep in touch with your family, especially those who are far away; you can also surprise your smart calendar digital wall by sending him a wish card; it's also great for keeping tech-illiterate elders in touch with the youngsters.

Allow PUT only for trusted clients

Understand what limit_except covers

limit_except is valid in a location context and accepts PUT in its method list. A block written as limit_except GET { ... } limits access to every method except GET and HEAD. That means the block also covers PUT, DELETE and any other non-GET method. It is not a PUT-only switch.

For a private upload network, the DAV example’s allow 192.168.1.0/32 followed by deny all permits only that single address. Replace it with the actual trusted network or host, and place authentication inside the same access design when an IP allowlist is not sufficient.

Layer authorization controls

  • Use an allowlist for a known management network or dedicated client host.
  • Add basic authentication, JWT authentication or an equivalent access-control module when identity matters.
  • Require TLS whenever credentials or file contents cross an untrusted network.
  • Keep the writable location separate from public read locations and from application source files.
  • Authorize the specific resource in the upstream application; a method allowlist alone does not prevent an authorized network client from overwriting the wrong path.

For direct DAV, filesystem ownership and mode are the final enforcement layer. For a proxy, the application must enforce ownership and authorization even if NGINX has already filtered the client.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Diagnose a 405 or failed PUT

The request selected the wrong location

NGINX chooses locations using its prefix and regular-expression matching rules. A more specific prefix, a regex location or a different server block may receive the request instead of the PUT-enabled block. Review the effective configuration, confirm the request’s host header, and use a temporary distinctive access-log format or response header to identify the handling location. Test the exact URL, including its trailing slash and hostname.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

The DAV module is missing

If a direct-upload location reports an unknown DAV directive or never handles PUT, inspect nginx -V. The module is not built by default and requires --with-http_dav_module. Installing a configuration file alone cannot add a module that is absent from the running binary.

The destination path cannot be created or written

Check the resolved path under root, the existence and permissions of client_body_temp_path, and the account used by NGINX workers. If the PUT targets nested directories, remember that create_full_put_path defaults to off. Enable it for a dedicated upload tree or create the directory hierarchy ahead of time. A filesystem denial can appear as a server error even though the HTTP method was recognized correctly.

Access controls reject the client

Inspect allow/deny rules, authentication requirements and any network policy in front of NGINX. Because limit_except GET covers PUT, a client that can read the location may still be blocked from writing it. Verify the source address NGINX actually sees, especially when another proxy or load balancer is in front.

The proxy sends the wrong path

Compare the public request path with the upstream path produced by proxy_pass. A URI suffix on proxy_pass replaces the matching location prefix; omitting the suffix preserves the original or normalized URI. Test a concrete path such as /api/items/42 and inspect the upstream request rather than guessing from the public URL.

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

The body or headers are not forwarded

Confirm that no inherited configuration sets proxy_pass_request_body off or proxy_pass_request_headers off. The defaults are on, but an included configuration can override them. Missing Content-Type, authorization or conditional headers can cause the application to reject a request that NGINX otherwise proxied successfully.

The upstream application rejects PUT

An API framework, route definition, authentication layer or business rule can return 405 even when NGINX forwarded the request correctly. Check the upstream response and logs, verify that the route declares PUT, and confirm that the resource identifier and representation satisfy the application’s rules. NGINX’s acceptance of the method is not an approval of the operation.

Logs do not match the test

Inspect both access and error logs while issuing one controlled request. The access log shows the client-visible status and timing; the error log can reveal a permission failure, upstream connection problem or location-level issue. Retest against a disposable resource after each configuration change so an existing file is not accidentally overwritten.

Production checklist

  • Choose direct DAV only for a deliberately limited file-drop use case; choose a proxy when PUT represents an application resource.
  • Use a dedicated writable path and verify the NGINX worker account’s permissions.
  • Compile or install NGINX with --with-http_dav_module before using direct DAV directives.
  • Enable only the DAV methods you need. dav_methods PUT is narrower than enabling DELETE, MKCOL, COPY and MOVE as well.
  • Decide whether missing directories should be created with create_full_put_path on, and understand the resulting filesystem permissions from dav_access.
  • Protect writes with network restrictions and authentication; do not treat a method allowlist as resource authorization.
  • For APIs, verify proxy_pass URI replacement and preserve request bodies and headers.
  • Log and test the complete path from client to upstream or filesystem before enabling production writes.
  • Use TLS and avoid exposing an unrestricted writable location to the public internet.
  • Define an overwrite and recovery policy. A successful PUT can replace an existing file or resource, so backups, versioning or application-level conflict checks may be necessary.

Which configuration should you use?

If a trusted process needs to place files at predictable paths and no application decision is required, a dedicated DAV location is the shorter design. Keep it isolated, restrict its clients and make the filesystem permissions explicit.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

If the URL identifies a business object, or if you need validation, authorization, ETags, version conflicts, partial-update semantics or non-filesystem storage, proxy PUT to the application. That arrangement gives the service that understands the data responsibility for deciding whether the update is valid. In both designs, verify the selected location, test with a disposable target and read the logs before treating a 405 as a method-support problem.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

API configurationHTTP PUTNGINXreverse proxyserver administrationWebDAV

Leave a Reply

Your email address will not be published. Required fields are marked *

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Recommended PC Tool
Recommended PC Tool
Crashes, No Sound, or Screen Glitches?Free driver scan
PC Slower Than It Used to Be?Free scan - under a minute

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.