Change all Confluence attachments ip
Asked by Nicol?s Coniglio:

Hello,

My Confluence server only has one private ip, and it is behind the firewall for security reasons of course. In the firewall exists a configuration for making a forward to the private ip.

The problem is that every link to an attachments points to the private ip like http://privateip:/download/attachment1

There is any way to change all links that points to attachments to the public ip?

Like this:

http://privateIP:privatePORT/download/att1--\> http://publicIP:publicPORT/download/att1

http://privateIP:privatePORT/download/att2--\> http://publicIP:publicPORT/download/att2

http://privateIP:privatePORT/download/att3--\> http://publicIP:publicPORT/download/att3

Just to add information, all this links are in different spaces and pages.

I need to do it everyone in one procedure, not one by one because we have a lot of links everywhere. Could someone help me please? Perhaps someone has been through the same.

Thanks in advance!

Regards,

Nicolas


Answers:
author: Nic Brough -Adaptavist-
body: This sounds like you are not running and connecting to Confluence on a single base url?

The attachments exist under the base url, like the rest of it, they don't have public and private urls.

comments: author: Nicol?s Coniglio
body: The base URL is the one opened to public IP and port, and we only access by that IP, so this isn't the problem.

After all the deploy, we published the Confluence Server to public IP and updated the base URL, but the attachments still points to the private IP.

Regards

Nicol?s


author: Nic Brough -Adaptavist-
body: If you change the base-url, then the links to the attachments will change to be based on the base-url, if you are looking at the proper attachment links - those generated by Confluence in macros and in the attachment displays inline and in the files list pages.

If you've been embedding the links in text, then Confluence has no way to know they need to change - you will need to edit the text containing them.


author: Nicol?s Coniglio
body: Just to explain the scenario better, I will tell how was all the process.

We had a Confluence Server with and old version, so we decided to migrate it. It was in the LAN for example in http://oldPrivateIP

We deploy a new VM, and we restore a backup in that server, to then do all the upgrade path to the last version. This new VM has another ip like http://newPrivateIP

After all the deploy and security terms achieved, we configured all to access via https://publicIP

The ip assigned to the attachments is http://newPrivateIP, so somehow Confluence knew where was every link to all the attachments, but at the last step (change base URL to https://publicIP) there wasn't the expected update.

So there isn't a macro issue or embedded links in the text, because if it was, the ip on attachment's links would be http://oldPrivateIP and not newPrivateIP.

Regards,

Nicolas


author: Nic Brough -Adaptavist-
body: Ok, I'm now lost on what is happening here.

Can you pick one example of where the urls are incorrect (include the url of the page that the browser is showing us), and show us the display where it is (e.g. the attachments screen for a page), what url you see in the tooltip when you hover the cursor over it and where it tries to take you when you click it?


author: Nicol?s Coniglio
body: After deeper investigating we realized that the most of links are updated to the defined Base URL.

There are **only a few** cases that still are pointing to the private IP. Perhaps there are particulary cases because of old versions combined or some plugins involved. We think that it is not worth spending time investigating the root cause, since it takes less time to update those links every time we find one, until all get updated.

Anyway, thanks a lot for spending time helping us! We appreciate it very much!

Regards,

Nicol?s