<html><head></head><body><div style="color:#000; background-color:#fff; font-family:Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif;font-size:16px"><div id="yiv4713681476"><div id="yui_3_16_0_ym19_1_1503831075148_21557"><div style="color:#000;background-color:#fff;font-family:Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif;font-size:16px;" id="yui_3_16_0_ym19_1_1503831075148_21556"><div id="yiv4713681476yui_3_16_0_ym19_1_1503557455731_74834">Hello Francis,</div><div id="yiv4713681476yui_3_16_0_ym19_1_1503557455731_74836"><br clear="none"></div><div id="yiv4713681476yui_3_16_0_ym19_1_1503557455731_69232">Thank you for your answer.</div><div id="yiv4713681476yui_3_16_0_ym19_1_1503557455731_69282">I've done many tests since then and yes indeed the problem came from the application => wordpress<br clear="none"></div><div dir="ltr" id="yiv4713681476yui_3_16_0_ym19_1_1503557455731_69210"><div id="yui_3_16_0_ym19_1_1503831075148_21590"><span id="yiv4713681476yui_3_16_0_ym19_1_1503557455731_74850"><br></span></div><div id="yui_3_16_0_ym19_1_1503831075148_21591" dir="ltr"><span id="yiv4713681476yui_3_16_0_ym19_1_1503557455731_74850">It's necessary to define these two variables WP_HOME and WP_SITEURL or $_SERVER['HTTP_HOST'] = $_SERVER['HTTP_X_FORWARDED_HOST'] in wp-config.php</span></div></div><div dir="ltr" id="yiv4713681476yui_3_16_0_ym19_1_1503557455731_76585"><span id="yiv4713681476yui_3_16_0_ym19_1_1503557455731_74850"><br clear="none"></span></div><div dir="ltr" id="yiv4713681476yui_3_16_0_ym19_1_1503557455731_78417"><span id="yiv4713681476yui_3_16_0_ym19_1_1503557455731_74850">From that question</span></div><div dir="ltr" id="yiv4713681476yui_3_16_0_ym19_1_1503557455731_78445">> Thats because the pages are called by the reverse proxy server<br id="yiv4713681476yui_3_16_0_ym19_1_1503557455731_78455" clear="none">> like http://10.1.1.10:80/app/application1/;and it can't use a FQDN<br id="yiv4713681476yui_3_16_0_ym19_1_1503557455731_78457" clear="none">> because it's in a private adressing<br id="yiv4713681476yui_3_16_0_ym19_1_1503557455731_78458" clear="none">Francis: I don't follow that last part.</div><div dir="ltr" id="yiv4713681476yui_3_16_0_ym19_1_1503557455731_78460">=> I mean that the reverse proxy uses an IP to connect to the backend web server. If it used a fqdn, it has to resolve it, through a dns request<br clear="none"></div><div dir="ltr" id="yui_3_16_0_ym19_1_1503831075148_23174"><div id="yui_3_16_0_ym19_1_1503831075148_24841"><br clear="none"></div><div id="yui_3_16_0_ym19_1_1503831075148_23176">I still have problems, the site doesn't diplay properly because it can't load a javascript</div><div id="yui_3_16_0_ym19_1_1503831075148_28148"><br></div><div id="yui_3_16_0_ym19_1_1503831075148_25602">On the reverse proxy</div><div id="yui_3_16_0_ym19_1_1503831075148_25603" dir="ltr">server {<br id="yui_3_16_0_ym19_1_1503831075148_28144">    listen 80;<br id="yui_3_16_0_ym19_1_1503831075148_28145">    listen 443 ssl;<br id="yui_3_16_0_ym19_1_1503831075148_28146">    server_name application1.org;<br id="yui_3_16_0_ym19_1_1503831075148_28147">...<br></div><div dir="ltr" id="yui_3_16_0_ym19_1_1503831075148_28923">    location / {<br id="yui_3_16_0_ym19_1_1503831075148_25707">        location ~ /\.ht { deny  all; }<br id="yui_3_16_0_ym19_1_1503831075148_25718">        proxy_pass        http://10.1.1.10/app1/;<br id="yui_3_16_0_ym19_1_1503831075148_25720">        proxy_http_version 1.1;<br id="yui_3_16_0_ym19_1_1503831075148_25721">        proxy_set_header  X-Real-IP        $remote_addr;<br id="yui_3_16_0_ym19_1_1503831075148_25722">        proxy_set_header  X-Forwarded-For  $proxy_add_x_forwarded_for;<br id="yui_3_16_0_ym19_1_1503831075148_25723">        proxy_pass_header Set-Cookie;<br id="yui_3_16_0_ym19_1_1503831075148_25724">    }<br id="yui_3_16_0_ym19_1_1503831075148_25737"><br></div><div id="yui_3_16_0_ym19_1_1503831075148_23197"><br clear="none"></div></div> <div class="yiv4713681476qtdSeparateBR" id="yui_3_16_0_ym19_1_1503831075148_23198"><div id="yui_3_16_0_ym19_1_1503831075148_30659">On the backend server</div><div id="yui_3_16_0_ym19_1_1503831075148_30660" dir="ltr">server {<br id="yui_3_16_0_ym19_1_1503831075148_31465">        listen 80 default_server;<br id="yui_3_16_0_ym19_1_1503831075148_31466">        server_name _;<br id="yui_3_16_0_ym19_1_1503831075148_31467">        index index.php;<br id="yui_3_16_0_ym19_1_1503831075148_31468">        root /var/www/htdocs;<br id="yui_3_16_0_ym19_1_1503831075148_31469"></div><div dir="ltr" id="yui_3_16_0_ym19_1_1503831075148_32296">...<br></div><div dir="ltr" id="yui_3_16_0_ym19_1_1503831075148_32288">        location /app1 {<br id="yui_3_16_0_ym19_1_1503831075148_31533">          root /var/www/htdocs/;<br id="yui_3_16_0_ym19_1_1503831075148_31534">          access_log /var/log/nginx/app1.access.log xforwardedLog;<br id="yui_3_16_0_ym19_1_1503831075148_31535">          error_log /var/log/nginx/app1.error.log;<br id="yui_3_16_0_ym19_1_1503831075148_31536">          index index.php;<br id="yui_3_16_0_ym19_1_1503831075148_31537">          try_files $uri $uri/ /app1/index.php$is_args$args;</div><div dir="ltr" id="yui_3_16_0_ym19_1_1503831075148_32369">          location ~ /\. { deny  all; }<br id="yui_3_16_0_ym19_1_1503831075148_32372">          gzip off;<br id="yui_3_16_0_ym19_1_1503831075148_33137">          location ~ \.php$ {<br id="yui_3_16_0_ym19_1_1503831075148_33201">              root           /var/www/htdocs;<br id="yui_3_16_0_ym19_1_1503831075148_33202">              try_files $uri =404;<br id="yui_3_16_0_ym19_1_1503831075148_33203">              fastcgi_pass   unix:/run/php-fpm.app1.sock;<br id="yui_3_16_0_ym19_1_1503831075148_33204">              fastcgi_split_path_info ^(.+\.php)(/.+)$;<br id="yui_3_16_0_ym19_1_1503831075148_33206">              fastcgi_index  index.php;<br id="yui_3_16_0_ym19_1_1503831075148_33207">              fastcgi_param  SCRIPT_FILENAME $document_root$fastcgi_script_name;<br id="yui_3_16_0_ym19_1_1503831075148_33208">              include        fastcgi_params;<br id="yui_3_16_0_ym19_1_1503831075148_33209">          }<br id="yui_3_16_0_ym19_1_1503831075148_33210"><br></div><div id="yui_3_16_0_ym19_1_1503831075148_34880"><br></div><div id="yui_3_16_0_ym19_1_1503831075148_34856">The request for the javascript looks like that</div><div id="yui_3_16_0_ym19_1_1503831075148_34879" dir="ltr">http://application1.org/?wooslider-javascript=load&t=1503832510&ver=1.0.0 HTTP/1.1</div><div dir="ltr" id="yui_3_16_0_ym19_1_1503831075148_35724">It arrives on the backend server I see it in the logs (file specified in the stanza location)<br></div><div dir="ltr" id="yui_3_16_0_ym19_1_1503831075148_37302">10.1.1.10 forwarded for IP_CLIENT - - [27/Aug/2017:13:15:12 +0200] "GET /app1/?wooslider-javascript=load&t=1503832510&ver=1.0.0 HTTP/1.1" 404 5 "http://application1.org/" "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:54.0) Gecko/20100101 Firefox/54.0"</div><div dir="ltr" id="yui_3_16_0_ym19_1_1503831075148_38134"><br></div><div dir="ltr" id="yui_3_16_0_ym19_1_1503831075148_40574">If I access a file from the internet, it works fine<a href="http://application1.org/wp-content/themes/Avada/images/divider-02.gif" id="yui_3_16_0_ym19_1_1503831075148_41545"><br></a></div><div dir="ltr" id="yui_3_16_0_ym19_1_1503831075148_41570">http://application1.org/wp-content/themes/Avada/images/divider-02.gif</div><div dir="ltr" id="yui_3_16_0_ym19_1_1503831075148_41531">So there's just a problem with the previous URL</div><div dir="ltr" id="yui_3_16_0_ym19_1_1503831075148_41757"><br></div><div dir="ltr" id="yui_3_16_0_ym19_1_1503831075148_41698">Another question, if I want to set expires header, would it be better to do it on the reverse proxy or on the backend server ?</div><div dir="ltr" id="yui_3_16_0_ym19_1_1503831075148_41758"><br></div><div dir="ltr" id="yui_3_16_0_ym19_1_1503831075148_43605">Regards<br></div><div dir="ltr" id="yui_3_16_0_ym19_1_1503831075148_41699"><br></div><div dir="ltr" id="yui_3_16_0_ym19_1_1503831075148_41678"><br></div></div><div class="yiv4713681476yqt8798774715" id="yiv4713681476yqt43297"></div></div></div></div><div class=".yiv4713681476yahoo_quoted"> <div style="font-family:Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif;font-size:16px;"> <div style="font-family:HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif;font-size:16px;"> <div dir="ltr"><font size="2" face="Arial"> Le Dimanche 20 août 2017 22h08, Francis Daly <francis@daoine.org> a écrit :<br clear="none"></font></div>  <br clear="none"><br clear="none"> <div class="yiv4713681476y_msg_container">On Fri, Aug 18, 2017 at 07:01:26AM +0000, Mik J via nginx wrote:<br clear="none"><br clear="none">Hi there,<br clear="none"><br clear="none">> What would you do if you had ?<br clear="none">> CLIENT <-> INTERNET <->Reverse_Proxy<->Web_Server<br clear="none"><br clear="none">That is the normal case, is it not? So just "use nginx as normal".<br clear="none"><br clear="none">> On de web server I just use one default virtual host with multiple<br clear="none">> sections.<br clear="none"><br clear="none">I think that if you configure your "back-end" server that way, you are<br clear="none">more likely to have problems reverse proxying than if you configure<br clear="none">"one virtual host = one application".<br clear="none"><br clear="none">If you want to reverse-proxy an application installed at one part of its<br clear="none">local url hierarchy, so that it looks like it is installed at another<br clear="none">part of the url hierarchy, then it is your job to make sure that any<br clear="none">part of the content returned that the client browser might interpret as<br clear="none">a url on this server, is correctly relative to the "another part". (It<br clear="none">presumably is by default relative to the "one part".)<br clear="none"><br clear="none">Unless the application was written with a config option to make that<br clear="none">job trivial, I think it is easier to have the "public" url and "private"<br clear="none">url be the same.<br clear="none"><br clear="none">On your system, you can configure it however you want to.<br clear="none"><br clear="none">> Thats because the pages are called by the reverse proxy server<br clear="none">> like <a rel="nofollow" shape="rect" target="_blank" onclick="return window.theMainWindow.showLinkWarning(this)" href="http://10.1.1.10/app/application1/;">http://10.1.1.10:80/app/application1/; </a>and it can't use a FQDN<br clear="none">> because it's in a private adressing<br clear="none"><br clear="none">I don't follow that last part.<br clear="none"><br clear="none">It can use a hostname if you want it to use a hostname.<br clear="none"><br clear="none">I expect that it will be easier for you if you use a hostname, or if<br clear="none">you use two services listening on different ports.<br clear="none"><br clear="none">> Is there a way that the reverse proxy connects to 10.1.1.10 but pretend<br clear="none">> the GET/POST queries use application1.org ?<br clear="none"><br clear="none">If you can describe the http request that you want the client to make<br clear="none">to nginx; and describe the matching http request that you want nginx to<br clear="none">make to the back-end, it may be clearer what you mean.<br clear="none"><br clear="none">> I'd prefer my application would be accessible by www.application1.org than<br clear="none">> www.application1.org/app/application1 like right now<br clear="none"><br clear="none">From the config you have shown, nginx makes the application available<br clear="none">at www.application1.org. It looks to me like it is the back-end which<br clear="none">causes it to appear at www.application1.org/app/application1.<br clear="none"><br clear="none">Possibly you should remove "proxy_redirect off;", and remove the<br clear="none">"proxy_set_header Host $http_host;" line.<br clear="none"><br clear="none">Good luck with it,<div class="yiv4713681476yqt1995332387" id="yiv4713681476yqtfd97919"><br clear="none"><br clear="none">    f<br clear="none">-- <br clear="none">Francis Daly        <a rel="nofollow" shape="rect" ymailto="mailto:francis@daoine.org" target="_blank" href="mailto:francis@daoine.org">francis@daoine.org</a></div><br clear="none">_______________________________________________<br clear="none">nginx mailing list<br clear="none"><a rel="nofollow" shape="rect" ymailto="mailto:nginx@nginx.org" target="_blank" href="mailto:nginx@nginx.org">nginx@nginx.org</a><br clear="none"><a rel="nofollow" shape="rect" target="_blank" href="http://mailman.nginx.org/mailman/listinfo/nginx">http://mailman.nginx.org/mailman/listinfo/nginx</a><div class="yiv4713681476yqt1995332387" id="yiv4713681476yqtfd91404"><br clear="none"></div><br clear="none"><br clear="none"></div>  </div> </div>  </div></div></body></html>