Question

I use jetty-maven-plugin to run my web application:

<plugin>
    <groupId>org.mortbay.jetty</groupId>
    <artifactId>jetty-maven-plugin</artifactId>
    <version>8.1.12.v20130726</version>
    <configuration>
        <webApp>
          <contextPath>/test</contextPath>
        </webApp>               
    </configuration>
</plugin>       

Next, I use nginx to proxify requests:

server {
   server_name q.ru;
   listen 80;

   location / {
      proxy_http_version 1.1;
      proxy_pass http://127.0.0.1:8080/test;
      proxy_set_header        X-Real-IP       $remote_addr;
      proxy_set_header        X-Forwarded-For $proxy_add_x_forwarded_for;
  }
}

Now, I open my browser, and send request to http://q.ru (localhost in my /etc/hosts). I get infinite redirection.

Here is HTTP dialog dump- request from nginx to jetty, and jetty response:

GET /test HTTP/1.1
Host: 127.0.0.1:8080
Connection: close
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Firefox/24.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: ru-RU,ru;q=0.8,en-US;q=0.5,en;q=0.3
Accept-Encoding: gzip, deflate

HTTP/1.1 302 Found
Location: http://127.0.0.1:8080/test/
Connection: close
Server: Jetty(8.1.12.v20130726)

Host and path are exactly specified in request. So why does jetty send 302 redirect ?

Était-ce utile?

La solution

I'm pretty sure this stackoverflow question might help you, I've been searching for similar thing.

Hope that helps.

Cheers

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top