-1

The app is on a Payara server and with a context root nocodeapp-web-front-1.0

I don't want to have this context root in the url. This nginx config gives the intended result for the index page of the app (it is live at https://test.nocodefunctions.com):

upstream payara {
    least_conn;
server localhost:8080 max_fails=3 fail_timeout=5s;
server localhost:8181 max_fails=3 fail_timeout=5s;

} server { if ($host = test.nocodefunctions.com) { return 301 https://$host$request_uri; }

listen        80;
access_log /var/log/nginx/payara-access.log;
error_log /var/log/nginx/payara-error.log;

client_max_body_size 100M;
server_name   test.nocodefunctions.com;
return        301 https://$host$request_uri;


}

server { listen 443 ssl; server_name test.nocodefunctions.com; client_max_body_size 100M;

ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_prefer_server_ciphers on;
ssl_ciphers "EECDH+AESGCM:EDH+AESGCM:AES256+EECDH:AES256+EDH";

location /nocodeapp-web-front-1.0 {
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header Host $http_host;
        proxy_set_header X-Forwarded-Proto https;
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "upgrade";
        proxy_no_cache $cookie_nocache  $arg_nocache$arg_comment;
        proxy_no_cache $http_pragma     $http_authorization;
        proxy_cache_bypass $cookie_nocache $arg_nocache $arg_comment;
        proxy_cache_bypass $http_pragma $http_authorization;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header Host $host:$server_port;
        add_header Access-Control-Allow-Origin *;
        proxy_set_header Access-Control-Allow-Origin *;
        proxy_pass http://payara$request_uri;
}

location = / {
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header Host $http_host;
        proxy_set_header X-Forwarded-Proto https;
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "upgrade";
        proxy_pass http://payara/nocodeapp-web-front-1.0$request_uri$is_args$args;
}

ssl_certificate /etc/letsencrypt/live/xxxxxx/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/xxxxxx/privkey.pem; # managed by Certbot

}

However when we navigate in the app by clicking on the "Go" button, the page at /choosefunction.html appears as:

https://test.nocodefunctions.com/nocodeapp-web-front-1.0/choosefunction.html

...the subpath nocodeapp-web-front-1.0 reappeared?

How can I get:

https://test.nocodefunctions.com/choosefunction.html

NB: I have checked these two questions 1 & 2, they don't work for me

seinecle
  • 101
  • 4

1 Answers1

1

You need to specify the application's root URL in the application configuration. This will make the application generate correct URLs for links and resources.

Tero Kilkanen
  • 38,887