Confluence - dynamic external link
Asked by Mircea Marin:

Hi,

we are using a self-hosted instance of Confluence which is accessible through a local IP address as well as a semi-public IP address. On the same server with the confluence instance we have another website hosted. The setup looks something like this:

Confluence:

* local address / host: confluence.idi.local
* local IP access: 172.16.1.6:8060
* external IP access: 3.215.106.6:8060

Wiki:

* local address / host: wiki.idi.local
* local IP access: 172.16.1.6/wiki
* external IP access: 3.215.106.6/wiki

My issue is the following: I need to find a way to display an image that is hosted on the Wiki site in Confluence when the page containing the link to the image is displayed from the local network but also from the external one.

Also, I can not access the local IP from the external network nor the external IP from the local network.

Is there any way to achieve this?

Thanks!


Answers:
author: rrudnicki
body: Hi Mircea,

What do you want to do can be done using rewrite mode. I don't now if you are using apache or another webserver. However, you can looking for the rewrite flag on google. Nowadays, almost all web server and load balancers support it.

Bellow you can see an example using apache:

Enable mod_rewrite and .htaccess through httpd.conf and then put this code in your .htaccess under DOCUMENT_ROOT directory:

Options +FollowSymLinks -MultiViews

# Turn mod_rewrite on

RewriteEngine On

RewriteBase /folder_path/where_is_the_image/

RewriteRule \^my_image\\.png$

Make sure:

* .htaccess is enabled
* mod_rewrite is enabled

In the link below you can find more details about mod_rewrite flags.

<http://httpd.apache.org/docs/2.0/mod/mod_rewrite.html>

I hope it helps.

Best regards,

Renato Rudnicki

Atlassian Support


author: Mircea Marin
body: Hi Tin,

let me explain this again. Let's say I have an image which is located at the following path:

wiki.idi.local/images/my_image.png

OR

172.16.1.6/wiki/images/my_image.png

I can link to this image in Confluence while using the above path and the image will be displayed correctly while I am accessing confluence from my local network (by using confluence.idi.local or 172.16.1.6:8060).

As soon as I access confluence from the external network (by using 3.215.106.6:8060) the path to this image can not be resolved anymore. In order to find this image from the external network I would need to use the following link:

3.215.106.6/wiki/images/my_image.png

If I use this link instead, I can not view the image from my internal network.

Is this a bit clearer?

What I wanted to know is if there is a way to have this image's link "translated" depending on the location where I access it from.

Thanks,

Mircea


author: TinA
body: Hello Mircea,

I was having a hard time understanding what you are attempting to accomplish with this comment. Could you please rephrase it?

```
My issue is the following: I need to find a way to display an image that is hosted on the Wiki site in Confluence when the page containing the link to the image is displayed from the local network but also from the external one.
```

Regarding not being able to access Confluence via internal IP over an external network. Every internal network generally has the same subnet configuration. The way you would reach that Confluence instance would be through the external IP and port number Confluence uses. Keep in mind you will need to make a Firewall NAT configuration to push that traffic to the correct Confluence server.

Another method is to VPN into the private network then access the Confluence server that way.

-Regards,  
Tin Nguyen \| Confluence Support.