Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Redirect IP Address to Subdomain

UJ July 15, 2019

After long time using different Atlassian products I have set up subdomains for all of them. Now users can still access with the IP address (e.g. jira: aaa.bbb.ccc.ddd:8080), but you get (of course) an error message because of the wrong base URL. Since some users have stored the IP address in their browser or address book I want to have a redirection to the subdomain:

aaa.bbb.ccc.ddd:8080 -> jira.mysubdomain.com

I've tried Apache Redirect for that without success:

<VirtualHost *:8080>
  ServerName http://aaa.bbb.ccc.ddd:8080
  Redirect 301 / https://jira.mysubdomain.com/
</VirtualHost>

 

Is it possible anyway, because of the reverse proxy? (https://confluence.atlassian.com/kb/proxying-atlassian-server-applications-753894340.html#ProxyingAtlassianServerapplications-ConnecttoyourapplicationviaaReverseProxyoverHTTP)

 

Is there a built in solution for Jira, Confluence or Bitbucket?

 

system: Ubuntu 18.04 server, latest confluence, jira and bitbucket. SSL and reverse proxy active.

3 answers

1 accepted

0 votes
Answer accepted
Thomas Deiler
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
July 15, 2019

Dear @UJ ,

sure this is possible. Follow this article and also read the comments.

So long

Thomas

UJ July 15, 2019

Hmm. I don't want to redirect from http to https but IP:port to domain.
I also read the comments and nobody describes my case.

Thomas Deiler
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
July 15, 2019

Dear @UJ ,

have you tried

<VirtualHost aaa.bbb.ccc.ddd:8080>
ServerName http://aaa.bbb.ccc.ddd:8080
Redirect 301 / https://jira.mysubdomain.com/
</VirtualHost>

In the end this a redirect from http to https. Just took this snippet from you original post.

So long

Thomas

Alexis Robert
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
July 15, 2019

Hi @Thomas Deiler , 

 

this won't work because users will not hit Apache (see my comment above) as they directly hit Tomcat with 8080 port. Apache only listens on ports 80 and 443, it won't be able to catch anything on 8080 (as it's used by Tomcat for Jira ...).

Thomas Deiler
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
July 15, 2019

 

Dear @UJ ,

@Alexis Robert  seems to be right. I recommend to change the port of Jira. For example to 8888. Then also adapt the reverse proxy settings. And add the 8080 with Apache to catch the request and redirect to 443.

Then you can be sure they won't access the old port.

So long

Thomas

UJ July 15, 2019

@Thomas Deilerand @Alexis Robert : ah, now I understand why my redirect doesn't work.

Changing the port for Jira is a good idea! I will check this out.

UJ July 15, 2019

Somehow this doesn't really work out. Now I just removed the port from the firewall. Not such an elegant solution but I have spent enough time with it :) Thanks @Thomas Deiler and @Alexis Robert  for the help!

0 votes
Amit Verma May 21, 2021

You can simply do this using your htaccess file. 

Here is the code to redirect IP to domain

RewriteEngine on
RewriteCond %{HTTP_HOST} ^1\.1\.2\.3$
RewriteRule (.*) https://sub.example.com/$1 [L,R=301]

Replace ip with your domain ip.

If you want to learn URL rewriting , you can follow this tutorial https://amitoverflow.com/2021/04/15/htaccess-tutorial-for-beginers/ 

0 votes
Alexis Robert
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
July 15, 2019

Hi @UJ , 

 

unfortunately you won't be able to use Apache to redirect users, since Apache is probably listening on ports 80 and 443 and your users are reaching port 8080 directly.

You could probably set up an iptable rule however, for example this post might help.

 

Let me know if this works, 

 

--Alexis

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events