Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [jetty-users] nginx as a reverse proxy?

Hi,

I don't see anything obviously wrong with your proxy config. 

I have just set up a couple of https-nginx -> http-jetty-9 proxies earlier this week with no issue, although I use fewer proxy options and use $http_host instead of $host, which depending on your server config does yield different things.
Not sure this affects your setup.

In any case, in case it helps, my proxy configs are along the lines of:


upstream jettyservice  {
        server 10.X.Y.Z:8080;
}

location /jettyserviceA/ {
        proxy_pass http://jettyservice/serviceA/;
        proxy_set_header Host $http_host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-Host $http_host;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Protocol  $scheme;

}


Cheers,

Ted








Ted McFadden
Chief Engineer

Leximancer Pty Ltd
Brisbane, Queensland,  Australia, 
ACN: 116 218 109

On 4 April 2016 at 21:14, Bjørn T Johansen <btj@xxxxxxxxxx> wrote:
Yes, I am trying to move my webapplications that currently runs on Tomcat over to Jetty. So now I am trying with the first one. (And everything works
as it should using nginx and tomcat).

The location section looks like this:


upstream appserver02 {
  server 10.x.x.x:8081 fail_timeout=0;
}

location  / {
                        proxy_redirect off;
                        proxy_pass      http://appserver02;
                        rewrite_log     off;

                        proxy_set_header Host             $host;
                        proxy_set_header X-Forwarded-Host $host;
                        proxy_set_header X-Forwarded-By $host;
                        proxy_set_header X-Real-IP      $remote_addr;
                        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
                        proxy_set_header X-Forwarded-Proto https;
                        proxy_set_header X-Scheme $scheme;

                        proxy_connect_timeout      30;
                        proxy_send_timeout         15;
                        proxy_read_timeout         15;

                        proxy_buffer_size                4k;
                        proxy_buffers                 4 32k;
                        proxy_busy_buffers_size         64k;
                        proxy_temp_file_write_size      64k;

                        proxy_next_upstream error timeout http_502 http_503 http_504;
                        error_page   502 503 504   http://www.domain.no/down.html;

                        proxy_max_temp_file_size 0;

                        client_max_body_size    20m;
                        client_body_buffer_size 128k;

                }


BTJ

On Mon, 4 Apr 2016 08:36:15 +1000
Ted McFadden <ted@xxxxxxxxxxxxxx> wrote:

> Hi,
>
> What does your nginx config 'location' section look like for the jetty
> proxy? And aside from the jetty proxy, https content is served ok from
> nginx?
>
> Cheers,
>
> Ted
>
>
> Ted McFadden
> Chief Engineer
>
> Leximancer Pty Ltd
> Brisbane, Queensland,  Australia,
> ACN: 116 218 109
>
> http://info.leximancer.com
>
>
>
>
> On 3 April 2016 at 23:41, Bjørn T Johansen <btj@xxxxxxxxxx> wrote:
>
> > I have setup virtual host on my Jetty and using nginx in front of it works
> > as it should, as long as I am using http. When I use https that is
> > terminated on my nginx server, Jetty does not respond anymore (I get an
> > http error 503 from nginx).
> >
> > I have the following context file on my Jetty server:
> >
> > <!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN" "
> > http://www.eclipse.org/jetty/configure_9_0.dtd">
> >
> > <Configure class="org.eclipse.jetty.webapp.WebAppContext">
> >   <Set name="contextPath">/</Set>
> >   <Set name="war">/opt/webapps/application.war</Set>
> >   <Set name="virtualHosts">
> >     <Array type="java.lang.String">
> >       <Item>www.domain.no</Item>
> >     </Array>
> >   </Set>
> > </Configure>
> >
> > Are there any particular config I am missing from Jetty to make this work
> > or?
> >
> >
> > Regards,
> >
> > BTJ
> >
> > --
> >
> > -----------------------------------------------------------------------------------------------
> > Bjørn T Johansen
> >
> > btj@xxxxxxxxxx
> >
> > -----------------------------------------------------------------------------------------------
> > Someone wrote:
> > "I understand that if you play a Windows CD backwards you hear strange
> > Satanic messages"
> > To which someone replied:
> > "It's even worse than that; play it forwards and it installs Windows"
> >
> > -----------------------------------------------------------------------------------------------
> > _______________________________________________
> > jetty-users mailing list
> > jetty-users@xxxxxxxxxxx
> > To change your delivery options, retrieve your password, or unsubscribe
> > from this list, visit
> > https://dev.eclipse.org/mailman/listinfo/jetty-users


_______________________________________________
jetty-users mailing list
jetty-users@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/jetty-users


Back to the top