0

I have no issue dealing with glassfish directly (with no Nginx). The issue comes when I access it through Nginx.

I have two servers: MY_NGINX_IP and MY_GLASSFISH_IP:8080

Basically, the http://MY_NGINX_IP works just fine and displays the index file. However, http://MY_NGINX_IP/webservice/v1/employee gives a 404 not found error.

While http://MY_GLASSFISH_IP:8080/webservice/v1/employee works just fine.

Note: http://MY_NGINX_IP produces the index file with no issues. Only when append /webservice/v1/employee to it then the error comes.

Hint: I am using Nginx v1.10.1 on Ubuntu

My upstreamm:

        upstream myownstream {
            server MY_SERVER_IP:8080;
    }

My location config:

        location / {
            # First attempt to serve request as file, then
            # as directory, then fall back to displaying a 404.
            try_files $uri $uri/ =404;
            proxy_pass http://myownstream;
            #proxy_pass http://127.0.0.1:8080;
            proxy_next_upstream  error timeout invalid_header http_500;
            proxy_connect_timeout 5;

            proxy_http_version 1.1;
            proxy_set_header Upgrade $http_upgrade;
            proxy_set_header Connection "upgrade";
            proxy_read_timeout 86400;
            proxy_set_header Host $host;
    }
Nabeel
  • 557
  • 4
  • 15

1 Answers1

0

Well. I solved the problem by commenting the following line:

try_files $uri $uri/ =404

I am not sure what side effects should this bring to the production environment though

Community
  • 1
  • 1
Nabeel
  • 557
  • 4
  • 15