nginx proxy not able to redirect to bamboo server instance

Debajyoti March 9, 2016

I am  very new to the nginx implementation. .


Bamboo-1 server url : https://<bamboo1-server>.domain.com/;

As per my understanding,

I have implemented SSL(self signed) in the nginx server and now default.conf looks as below

erver {

listen 443;
server_name <nginx-server>;

ssl on;
ssl_certificate /etc/nginx/ssl/.crt;
ssl_certificate_key /etc/nginx/ssl/.key;

location / {
root /usr/share/nginx/html;
index index.html index.htm;
}

location /bamboo1 {

proxy_pass https://<bamboo1-server>.domain.com/;



 

https://<proxy-server>/bamboo1 is giving 404 error. I don't want to configure context root in application side.

Please let me know if  this is feasible. 

2 answers

2 votes
Kalle Sirkesalo March 9, 2016

Hello,

 

So you need to configure your tomcat (server.xml) in Bamboo with kind of the following:

&lt;Connector port="7990" 
     protocol="HTTP/1.1"
     connectionTimeout="20000"
     useBodyEncodingForURI="true"
     redirectPort="443"
     compression="on"
     compressableMimeType="text/html,text/xml,text/plain,text/css,application/json,application/javascript,application/x-javascript"
     secure="true"
     scheme="https"
     proxyName="mycompany.com" 
     proxyPort="443" /&gt;

 

Then you have to setup nginx with Bamboo:

 

server {
	listen          443;
    server_name     mycompany.com;
	
	ssl                  	on;
    ssl_certificate      	&lt;path/to/your/certificate&gt;;
    ssl_certificate_key  	&lt;path/to/your/certificate/key&gt;;
    ssl_session_timeout  	5m;
    ssl_protocols  			TLSv1 TLSv1.1 TLSv1.2;
    ssl_ciphers  			HIGH:!aNULL:!MD5;
    ssl_prefer_server_ciphers   on;
	
	# Optional optimisation - please refer to http://nginx.org/en/docs/http/configuring_https_servers.html
	# ssl_session_cache   shared:SSL:10m;
    location / {
        proxy_pass 			http://localhost:7990;
		proxy_set_header 	X-Forwarded-Host $host;
        proxy_set_header 	X-Forwarded-Server $host;
		proxy_set_header    X-Forwarded-For $proxy_add_x_forwarded_for;
		proxy_set_header    X-Real-IP $remote_addr;
		proxy_redirect 		off;
    }
}
nginx -s reload

If you are using Linux servers that have hardening options on you have to configure those. 

 

Debajyoti March 9, 2016

All the configuration looks fine in my implementation.  My question was around context root.

 

I want to access https://<proxy-name>/bamboo1 without configuring the respective context root (/bamboo1) defining in bamboo server.xml. 

 

My NGINX implementation is working well when i configured bamboo1 as context root in server.xml, but without context root https://<proxy-name>/bamboo1 giving 404 erro

Kalle Sirkesalo March 9, 2016

404 comes as page not found which is probably cause you are defining your bamboo server url wrong.

 

So what you are doing is pointing your server like this

My reverse proxy > connect to bamboo using proxy pass my reverse proxy > bamboo are you there in the reverse proxy? > return 404

 

Your proxy pass configuration is supposed to link to the bamboo address: 

 Like following:

location /bamboo1 {
        proxy_pass          http://bambooserver:bambooPort;
    
    }
Debajyoti March 9, 2016

As i mentioned above my proxy_pass configuration is same as you mentioned, but giving 404 error.

 

location /bamboo1 { 

proxy_pass https://bamboo1-server:port;

Kalle Sirkesalo March 9, 2016

Are you using HTTPS in the Bamboo server also? Cause if not then it should be http.

Debajyoti March 9, 2016

Yes , i am using https in bamboo server. 

Kalle Sirkesalo March 9, 2016

Which server are you using? 

Does it have SELinux? If yes have you checked that it doesn't stop anything?

 

Are you exiting the same domain? (Do you need to create CORS?)

 

The address answers from the proxy server?  

0 votes
Debajyoti March 9, 2016

All the configuration looks fine in my implementation.  My question was around context root.

 

I want to access https://<proxy-name>/bamboo1 without configuring the respective context root (/bamboo1) defining in bamboo server.xml. 

 

My NGINX implementation is working well when i configured bamboo1 as context root in server.xml, but without context root https://<proxy-name>/bamboo1 giving 404 error.

 

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events