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 6738405
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T11:21:54+00:00 2026-05-26T11:21:54+00:00

I have Nginx in front of a Node.js app. I have it set up

  • 0

I have Nginx in front of a Node.js app. I have it set up so that if the url has /account in it, it’ll redirect to HTTPS. My question is – how do I set it up so that if the user leaves the /account url (clicks a link to go to the home page), it’ll get sent back to HTTP?

Here’s my ngnix.conf:

worker_processes  1;

error_log  logs/error.log;

pid        logs/nginx.pid;

events {
    worker_connections  128;
}

http {
    include       mime.types;
    default_type  application/octet-stream;

    sendfile        on;

    server_tokens off;

    #keepalive_timeout  0;
    keepalive_timeout  65;
    tcp_nodelay        on;
    proxy_buffer_size   128k;
    proxy_buffers   4 256k;
    proxy_busy_buffers_size   256k;

    gzip  on;

    server {
        listen       80;
        server_name  localhost;

        location / {
            proxy_set_header x-path $uri;
            proxy_set_header X-Real-IP $remote_addr;
            proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
            proxy_set_header Host $http_host;
            proxy_set_header X-NginX-Proxy true;
            proxy_pass http://127.0.0.1:3000;
            proxy_redirect off;
        }

        location /account {
          rewrite ^(.*) https://$host$1 permanent; #redirect to https
        }

        error_page  404              /404.html;

        # redirect server error pages to the static page /50x.html
        #
        error_page   500 502 503 504  /50x.html;
        location = /50x.html {
            root   html;
        }

    }

    server {
        listen 443;
        ssl on;

        ssl_certificate ssl/server.crt;
        ssl_certificate_key ssl/server.key;

        location / {
            proxy_set_header Host $http_host;
            proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
            proxy_set_header X-M-Secure "true";
            proxy_redirect off;
            proxy_max_temp_file_size 0;
            proxy_pass http://127.0.0.1:3000;
        }
    }
}

Thanks in advance for any assistance.

  • 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-05-26T11:21:54+00:00Added an answer on May 26, 2026 at 11:21 am

    This is untested.

    server {
        listen 443;
        ssl on;
    
        ssl_certificate ssl/server.crt;
        ssl_certificate_key ssl/server.key;
    
        location /account/ {
            proxy_set_header Host $http_host;
            proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
            proxy_set_header X-M-Secure "true";
            proxy_redirect off;
            proxy_max_temp_file_size 0;
            proxy_pass http://127.0.0.1:3000;
        }
    
        location / {
            rewrite ^(.*) http://$host$1 permanent; # redirect to http
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have setup nginx as a front end to an node.js app. My nginx
I have running nginx on my server ansel.ms and a node.js app on ansel.ms:46156.
I've set up Nginx as my main web server and have two Mochiweb based
I have a setup where my nginx is in front with apache+PHP behind. My
I have nginx all set up for my needs... it's a wildcard directory based
I have a rewrite that nginx calls like so: location ~* (css)$ { rewrite
Now that I have nginx setup I need to be able to hide my
I am running nginx 0.6.32 as a proxy front-end for couchdb. I have my
I have Nginx as my front-end web server listening on port 80. And certain
I have Nginx with Passenger. In nginx.conf I have line: user pass users; and

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.