Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

240
Views
wild card match on request headers for nginx

I am using nginx as a proxy server to send the requests to backend pool members .

I have a header -- Content-Type: multipart/form-data; boundary="21ad608c-8e00-4c0c-8a06-5ed1280e9532" The boundary value in the header changes all the time.

How can I do a header check for only "Content-Type: multipart/form-data;" value and route the requests to the backend. when I do a print of $http_content_type value , everything including boundary value is getting printed . I am not able to do an if check on just " Content-Type: multipart/form-data; " value .

Can I put a wild card in the nginx config like -- "multipart/form-data; * " to pass the if loop ?

Please let me know.

over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

An Nginx wildcard? Yes, sort of, via a regex:
if ($http_content_type !~ '^multipart/form-data;') deny-the-request

This means that the Content-Type must start with multipart/form-data;. After that, any boundary=...whatever... is allowed.

Complete example:

  location /-/upload-public-file {
    limit_except POST OPTIONS {
      deny  all;
    }

    if ($http_content_type !~ '^multipart/form-data;') {
      return 406;  # status code Not acceptable
    }
over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!