I managed to fix the issue: the value of header "Host" contained only IP. After setting it to: IP:EXT_PORT, everything started working. I'll post this to wiki later on.
Regards! On Dec 21, 2015 10:51, "Max Kovgan" <[email protected]> wrote: > Hi, Daniel! > Thanks, for the direction. > whatever you've suggested, I ran: > import hudson.model.* > import jenkins.model.* > import org.kohsuke.stapler.* > > println > org.kohsuke.stapler.Stapler.getCurrentRequest().getHeader('X-Forwarded-Port') > println Jenkins.instance.rootUrlFromRequest > > The output was: > > [(master)]: > null > http://$EXT_IP/jenkins/ > > > Yet, I expected to see: > > [(master)]: > $EXT_PORT > https://$EXT_IP:$EXT_PORT/jenkins/ > > > My nginx config did not have: > proxy_set_header X-Forwarded-Port $EXT_PORT; > proxy_set_header X-Forwarded-Proto https; > > I have "played" a couple of minutes to this groovy: > import hudson.model.* import jenkins.model.* import org.kohsuke.stapler.* > for (def suffix in ["Port", "Proto", "For"]) { def header = "X-Forwarded-" > + suffix println "Header: " + header + "=" + > org.kohsuke.stapler.Stapler.getCurrentRequest().getHeader(header) } println > "Jenkins.instance.rootUrlFromRequest=${Jenkins.instance.rootUrlFromRequest}" > > > Running it renders good output. > > Now, after having that set, I am getting a "nicer" erroneous behaviour: > Port is ignored, and the URLs get to: > https://$EXT_IP/jenkins/$rest_of_the_path, > and it now renders "access denied", which is cool (b/c on https port 443 > we have a different application) > > BUT I WANT NGINX + JENKINS to work > What am I doing wrong ? > > I'm posting my current /etc/nginx/conf.d/ssl.location.d/jenkins.conf > > > ___________________________________________ > > > On Monday, December 21, 2015 at 2:29:39 AM UTC+2, Daniel Beck wrote: >> >> >> On 20.12.2015, at 23:13, Max Kovgan <[email protected]> wrote: >> >> > So, is this possible with my nginx misconfigured? >> >> Are you setting X-Forwarded-Port? Find out by running >> `org.kohsuke.stapler.Stapler.getCurrentRequest().getHeader('X-Forwarded-Port')` >> in the script console. >> >> Also interesting would be what the output of >> `Jenkins.instance.rootUrlFromRequest` is, as well as what is configured as >> the canonical URL to Jenkins in the system configuration. >> >> >> -- > You received this message because you are subscribed to a topic in the > Google Groups "Jenkins Users" group. > To unsubscribe from this topic, visit > https://groups.google.com/d/topic/jenkinsci-users/9ZCj5Jrcpm0/unsubscribe. > To unsubscribe from this group and all its topics, send an email to > [email protected]. > To view this discussion on the web visit > https://groups.google.com/d/msgid/jenkinsci-users/f669bb9e-1816-49c5-a5b2-5cd3f6b92df3%40googlegroups.com > <https://groups.google.com/d/msgid/jenkinsci-users/f669bb9e-1816-49c5-a5b2-5cd3f6b92df3%40googlegroups.com?utm_medium=email&utm_source=footer> > . > 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 [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/CAKBhgffmfq3%2BfB%3DPrnUqvoi8oh1TUfqSRM-c-wjqdSceGER%3Dow%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
