Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8743789
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T11:44:22+00:00 2026-06-13T11:44:22+00:00

I have difficulties to apply this if statement in my nginx config: location /

  • 0

I have difficulties to apply this if statement in my nginx config:

location / {
    break;
    proxy_pass                  http://127.0.0.1:4444;
    proxy_redirect              off;
    proxy_set_header            Host                        $host;
    proxy_set_header            X-Real-IP               $remote_addr;
    proxy_set_header            X-Forwarded-For         $proxy_add_x_forwarded_for;

    if ($arg_charset ~* windows-1251) {
        charset                     windows-1251;
    }
    source_charset              utf-8;
}

I have tried $arg_charset ~* “windows-1251” and $arg_charset ~* /.windows-1251./ and all others solutions. None does work…
Removing if statements give me wanted results, so the problem is inside if statement condition.

It’s a bug or i’m doing it wrong?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T11:44:23+00:00Added an answer on June 13, 2026 at 11:44 am

    As http://wiki.nginx.org/IfIsEvil explains, if blocks inside a location are known to be potentially problematic when they contain anything other then a return or rewrite

    try simply moving the if into the server block directly (where if has no problems) that should fix it.

    updated to avoid using charset directive in serverblock:

    try something like the following:

    set $requestedcharset utf-8;
    if ($arg_charset ~* windows-1251) { set $requestedcharset windows-1251;}
    
    location / {
      source_charset utf-8;
      charset $requestedcharset;
      #add in the rest of your / config
    }
    

    NOTE: make sure you have the win-utf charset_map included in your http block (on my debian system that means include /etc/nginx/win-utf;)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have difficulties developing 4x1 widget for Android. This is the appprovider <?xml version=1.0
I know this question had been asked a hundred times, but I have difficulties
I have a lot of difficulties in trying to translate this SQL query to
I have difficulties in understanding why we get the output of this code: <?php
I am new in JavaScript and I have difficulties fixing this. There are three
I have difficulties to use complex numbers in cuda,pycuda. I have this in C:
I have difficulties in seeing the point of the Access-Control-Allow-Origin http header. I thought
I have difficulties with using the this keyword in a MooTools (1.3) class. The
I am have difficulties solving this problem: For a positive number n, define C(n)
Hi i have difficulties trying to translate this .sh file to a .bat file.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.