Where does Jenkins.instance.rootUrlFromRequest get the address from? How can I reproduce that outside of Jenkins?
On Tuesday, 29 July 2014 22:26:24 UTC+1, Hansen Loke wrote: > > Ok, after the move again I ran the commands and now got: > > > http://my.machine.com:8080:8080/jenkins/http://my.machine.com:8080/jenkins/my.machine.com:8080 > null > > > > So it looks like with the change it some how introduced extra port in the > url. But if it's the port forwarding or reverse proxy issue then I would > have expected the problem to have existed before the move. Could there be > some configuration file that I have missed to update after moving to a > different location? > > > On Monday, 28 July 2014 22:22:26 UTC+1, Hansen Loke wrote: > >> I've reverted the move for now as there were some backlogs of builds to >> clear up. I've tried the commands in the reverted state and it gives: >> >> http://my.machine.com:8080/jenkins/ >> http://my.machine.com:8080/jenkins/ >> my.machine.com:8080 >> null >> >> I'll try the move again tomorrow with the commands. It is possible that >> reverse proxy is in place. The server has access to two vlans which may >> confuse things abit, but I was thinking that I'm just changing the location >> of where the Jenkins home is and running from different user that all other >> settings should just be the same. >> >> >> On Monday, 28 July 2014 18:14:07 UTC+1, Daniel Beck wrote: >>> >>> Run the following in Script Console and report the output: >>> >>> println Jenkins.instance.rootUrlFromRequest >>> println JenkinsLocationConfiguration.get().url >>> println >>> org.kohsuke.stapler.Stapler.currentRequest.getHeader('X-Forwarded-Host') >>> println >>> org.kohsuke.stapler.Stapler.currentRequest.getHeader('X-Forwarded-Port') >>> >>> Are you accessing Jenkins through a reverse proxy? >>> >>> On 28.07.2014, at 18:12, Hansen Loke <hanse...@gmail.com> wrote: >>> >>> > The config is the same as before the move, so it's: >>> http://my.machine.com:8080/jenkins/ >>> > >>> > >>> > >>> > On Monday, 28 July 2014 17:08:23 UTC+1, Daniel Beck wrote: >>> > What's configured in Manage Jenkins » Configure System » Jenkins >>> Location » Jenkins URL? >>> > >>> > On 28.07.2014, at 12:08, Hansen Loke <hanse...@gmail.com> wrote: >>> > >>> > > Hi, >>> > > >>> > > Recently I've moved the Jenkins installation to a different HDD >>> location on the same host, and to be started by a different user, reasons >>> for the move was that it was previously freeloading from another user. >>> After this move all *nix slave nodes connects fine but the windows jnlp >>> slave node doesn't come up anymore with the following errors in the slave >>> node logs: >>> > > >>> > > jenkins-slave.err.log: >>> > > >>> > > JNLP file >>> http://my.machine.com:8080/jenkins/computer/node01/slave-agent.jnlp?encrypt=true >>> >>> has invalid arguments: [<some_hex>, node01, -url, >>> http://my.machine.com:8080/jenkins/, -url, >>> http://my.machine.com:8080:8080/jenkins/, -headless, -jar-cache, >>> C:\.jenkins\cache\jars] >>> > > Most likely a configuration error in the master >>> > > "http://my.machine.com:8080:8080/jenkins/" is not a valid value for >>> "-url" >>> > > >>> > > >>> > > I had a look in the downloaded slave-agent.jnlp file from the >>> website and it has: >>> > > >>> > > <jnlp spec="1.0+" codebase=" >>> http://my.machine.com:8080/jenkins/computer/node01/"><information><title>Slave >>> >>> Agent for node01</title><vendor>Jenkins project</vendor><homepage href=" >>> https://jenkins-ci.org/"/></information><security><all-permissions/></security><resources><j2se >>> >>> version="1.5+"/><jar href=" >>> http://my.machine.com:8080/jenkins/jnlpJars/remoting.jar"/><property >>> name="hudson.showWindowsServiceInstallLink" >>> value="true"/></resources><application-desc >>> main-class="hudson.remoting.jnlp.Main"><argument>some_hex</argument><argument>node01</argument><argument>-url</argument><argument> >>> http://my.machine.com:8080/jenkins/</argument><argument>-url</argument><argument>http://my.machine.com:8080:8080/jenkins/</argument></application-desc></jnlp> >>> >>> >>> > > >>> > > The part where it is marked in bold font is the part where it is >>> complaining about, whereas before the move it didn't have this extra url. >>> > > >>> > > I then had a look at the Jenkins source code to see where did this >>> url come from: >>> > > >>> > > The file in >>> jenkins-master/core/src/main/resources/hudson/slaves/SlaveComputer/slave-agent.jnlp.jelly >>> >>> has this: >>> > > >>> > > <j:if test="${rootURL!=app.rootUrlFromRequest}"> >>> > > <!-- >>> > > rootURL is based on the URL in the system config, but >>> there has been >>> > > numerous reports about people moving Jenkins to another >>> place but >>> > > forgetting to update it. To improve the user experience >>> in this regard, >>> > > let's also pass the URL that the browser sent us as >>> well, so that the >>> > > JNLP Main class can try both. >>> > > >>> > > Note that rootURL is still necessary in various >>> situations, such >>> > > as reverse HTTP proxy situation, which makes >>> rootUrlFromRequest incorrect. >>> > > --> >>> > > <argument>-url</argument> >>> > > <argument>${app.rootUrlFromRequest}</argument> >>> > > >>> > > Thus, this means that somehow after the move the rootUrlFromRequest >>> is now different. Except now I'm lost where to find and correct the "root >>> URL from request" or where that is being set. >>> > > >>> > > After the move I've already grep and replaced paths in the Jenkins >>> setting that pointed to the old location. >>> > > >>> > > Any pointers to where I should look next? >>> > > >>> > > Cheers, >>> > > Hansen >>> > > >>> > > >>> > > >>> > > -- >>> > > You received this message because you are subscribed to the Google >>> Groups "Jenkins Users" group. >>> > > To unsubscribe from this group and stop receiving emails from it, >>> send an email to jenkinsci-use...@googlegroups.com. >>> > > For more options, visit https://groups.google.com/d/optout. >>> > >>> >>> -- You received this message because you are subscribed to the Google Groups "Jenkins Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-users+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.