Welcome! Log In Create A New Profile

Advanced

Newbie: Proxy to Glassfish

GZ1
April 08, 2011 03:25PM
Hello,
I'm migrating an app from Apache/JBoss to nginx/Glassfish. I think I'm starting to grasp the server-location design but am getting errors when I try to proxy a request to Glassfish. Here's a clip from my config:

server {
server_name www.foobar.com foobar.com;
root html/prod;
index index.html;
location /dc {
proxy_pass $scheme://localhost:8080$request_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;
}
}

The gist of it is I want all dynamic content (dc) to go to glassfish, i.e. foobar.com/dc/somepath/page.jsp
Everything else (presumably the static content) is served from html/prod. (That part works)
I want the path to determine what happens, not the file extensions (because I have some .js that is static and other that is generated by the server).

I have a "hello world" app running on glassfish that works when accessed directly from localhost:8080/webtest/home,
but when I try foobar.com/dc/webtest/home I get a 502 Bad Gateway error in the browser. The nginx error log reports this:

2011/04/08 14:13:30 [notice] 3884#3940: signal process started
2011/04/08 14:13:35 [error] 828#3472: *6 no resolver defined to resolve localhost, client: 127.0.0.1, server: www.foobar.com, request: "GET /dc/webtest/home HTTP/1.1", host: "foobar.com"

Any ideas what might be wrong with my configuration?
Thanks!
Greg
Subject Author Posted

Newbie: Proxy to Glassfish

GZ1 April 08, 2011 03:25PM

Re: Newbie: Proxy to Glassfish

Maxim Dounin April 08, 2011 04:48PM

Re: Newbie: Proxy to Glassfish

GZ1 April 08, 2011 05:17PM

Re: Newbie: Proxy to Glassfish

GZ1 April 08, 2011 05:55PM

Re: Newbie: Proxy to Glassfish

edogawaconan April 09, 2011 05:02AM

Re: Newbie: Proxy to Glassfish

Cliff Wells April 09, 2011 01:28PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 231
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready