Internal application - Publish on nginx

agomes nginx-forum at forum.nginx.org
Fri Dec 3 12:37:27 UTC 2021


Hi people.

I am configuring Nginx to publish my Internal portal.

My portal is hosted on my server https://x.x.x.x:8443

the principal url of this protal is https://x.x.x.x:8443/pwm/private/login.
This URL I don't need to publish.

inside this portal I have another URL that I would like to publish. see
below.

https://x.x.x.x:8443/pwm/public/forgottenpassword

I've tried to use the configuration below.

##########################NGINX CONFIGURATION#########################

upstream myapp {
  server x.x.x.x:8443;
}

server {
  server_tokens off;
  modsecurity on;
  modsecurity_rules_file /etc/nginx/modsec/main.conf;

  listen 443 ssl;
  listen 80;
  server_name x.x.x.x.com;
  ssl_prefer_server_ciphers On;
  ssl_protocols TLSv1.2 TLSv1.3;
  ssl_ciphers AES256+EECDH:AES256+EDH:!aNULL;

  # security headers
  add_header X-Frame-Options "SAMEORIGIN" always;
  add_header X-XSS-Protection "1; mode=block" always;
  add_header X-Content-Type-Options "nosniff" always;
  add_header Referrer-Policy "no-referrer-when-downgrade" always;
  add_header Content-Security-Policy "default-src * data: 'unsafe-eval'
'unsafe-inline'" always;
  add_header Strict-Transport-Security "max-age=31536000; includeSubDomains;
preload" always;

  ssl_certificate /etc/nginx/ssl/wildcard-fullchain.pem; # wildcard ca full
chain certificate
  ssl_certificate_key /etc/nginx/ssl/wildcard-key.pem; # wildcard private
certificate

  client_max_body_size 5M;

  root /var/www/;
  index index.html;


  if ($scheme != "https") {
    rewrite ^ https://$http_host$request_uri? permanent;
  }

  location ^~ /.well-known/pki-validation/ {
    allow all;
    root /var/www/;
    default_type "text/plain";
    try_files $uri =404;
  }



  location /app {
     proxy_pass https://myapp/pwm/public/forgottenpassword;
     #rewrite ^/(.*)/pwm/public$ /$1 break;
     proxy_redirect default;
     proxy_set_header Host $host;
  }


   access_log /var/log/nginx/access.log myAccess;
   error_log /var/log/nginx/error.log;
}

##########################END CONFIGURATION####################

When I do this, the /app does not work but when try internally the address 
https://x.x.x.x:8443/pwm/public/forgottenpassword it works like expected.

I am working on this for a long time without any result.

Thank you in advance for the help.

Posted at Nginx Forum: https://forum.nginx.org/read.php?2,292998,292998#msg-292998



More information about the nginx mailing list