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

128
Views
Nginx redirecting too many times

I am running into an issue where nginx is somehow redirecting over and over but I don't understand why:

server {
  listen 80;
  server_name splunk.trever.me;
  return 301 https://splunk.trever.me$request_uri;
}

# Port 443 https config
server {
  listen 443 ssl http2;
  server_name splunk.trever.me;

  location / {
    proxy_buffers 16 4k;
    proxy_buffer_size 2k;
    proxy_pass http://10.0.1.1:8000;
  }

 access_log /var/log/nginx/splunk.trever.me/access.log;
 error_log /var/log/nginx/splunk.trever.me/error.log;

}

Am I missing something here? I looked at all the documentation and it doesnt seem to be wrong. Does this mean something upstream is sending the browser back to http?

over 4 years ago · Santiago Trujillo
2 answers
Answer question

0

use this:

server {

  server_name splunk.trever.me;

  if ($http_x_forwarded_proto = "http") {
      return 301 https://$host$request_uri;
  }

  location / {
    proxy_buffers 16 4k;
    proxy_buffer_size 2k;
    proxy_pass http://10.0.1.1:8000;
  }

 access_log /var/log/nginx/splunk.trever.me/access.log;
 error_log /var/log/nginx/splunk.trever.me/error.log;

}
over 4 years ago · Santiago Trujillo Report

0

You can redirect the requests using the IF directive in nginx config.

server {
        listen 80;
        listen 443;
        server_name splunk.trever.me;

        if ($scheme = http) {
          rewrite ^/(.*)$ https://splunk.trever.me/$1 permanent;
        }
        location / {
            proxy_buffers 16 4k;
            proxy_buffer_size 2k;
            proxy_pass http://10.0.1.1:8000;
        }

        access_log /var/log/nginx/splunk.trever.me/access.log;
        error_log /var/log/nginx/splunk.trever.me/error.log;
} 

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!