HTTPS Problem with Attachments

Hello Devs :slightly_smiling_face:

I have just deployed a Wiki with HTTPS protocol, but when I want to upload a file in the ‘Attachments’ part of a Wiki page, I get the following error:

image

In addition, the following error appears in the console:
image

To make the Wiki configuration I have modified the file ‘xwiki.cfg’ adding the following lines:

xwiki.home=https://my.domain.com/
wiki.url.protocol=https

What happens after I have made the change is that the Wiki does allow me to upload attachments, but I always get that error message, as if no file has been uploaded to the Wiki.

Why does the error message keep coming up if the file is uploaded correctly? Any idea?

Any help or advice would be greatly appreciated

Thank you very much

Cheers,
Santiago :slight_smile:

Can anyone answer this question? I’m looking for a answer because I have the same question. If anyone has one, please tag me. Thanks a lot.

1 Like

Hey hey, I have an xwiki running over https . I am wondering how you set up the certificate side of things, could you share anything in that regard?

You’re not getting https errors or anything when loading a page?

You might want to give a bit more information about your wiki installation.

Do you have a proxy installed to access xwiki? Where is your SSL termination handled?

Without information, your problem is really hard to diagnose.

Hello everyone :slight_smile:

  • To add the HTTPS certificate, I used Let’s encrypt and Ngnix for the SSL signature.
    On the Wiki side, I only modified the “xwiki.cfg” file with the following lines:

image

  • No, I am not having problems when loading pages, all my Wiki loads perfectly and all the views are accessible, my only problem is when uploading the “Attachments” to a page, because I always get that error message but it is really saving the content, but seeing that error message for the end user is not comfortable at all.

I am using the default configuration of the Wiki, also using the version 14.10.19.
I am handle the SSL using Nginx and Let’s Encrypt to have an SSL certification.

I just modified the xwiki.cfg file in order to use the HTTPS protocol as I showed it with a screenshot in an earlier answer.

Any ideas with the error message?

so I’m assuming you’re using https proxy >> nginx http

Try adding the following Inside the location directive:

proxy_set_header X-Forwarded-Proto $scheme;

from How to solve nginx reverse proxy mixed content(http, https) - Server Fault

1 Like

thank you very much for the help!
I will take a look at it and see if it works for me

Assuming your nginx proxy connects to your xwiki server via http, you may also have to add in a “proxy_redirect” command in your nginx configuration.

2 Likes

Hello everyone,
I found a solution to this issue, I followed this documentations as well:
https://www.xwiki.org/xwiki/bin/view/Documentation/AdminGuide/Installation/InstallationWAR/InstallationTomcat/#HConfiguringtomcatforhttps

But since it does not have all the steps, you will have to do the next steps in order to avoid the error message:

  1. Nginx Configuration, we add the next lines:

server {
listen 80;
server_name your.server.name.here;

location ~ /.well-known {
    allow all;
}

rewrite     ^   https://$server_name$request_uri? permanent;
# Redirigir todas las solicitudes HTTP a HTTPS
return 301 https://$host$request_uri;

}

server {
listen 443 ssl; # managed by Certbot
server_name your.server.name.here;

root /var/www/html;

# Configuration to avoid Request Entity too large error 413
client_max_body_size 0;


ssl_certificate /etc/letsencrypt/live/your.server.name.here/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/your.server.name.here/privkey.pem; # managed by Certbot
include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot

location / {
    proxy_set_header Host $http_host;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forward-For $proxy_add_x_forwarded_for;
    proxy_set_header X-Forwarded-Proto $scheme;
    proxy_set_header X-Scheme $scheme;
    proxy_redirect off;
    if (!-f $request_filename) {
        proxy_pass http://your.ip.here;
        break;
    }
}

location ~ /.well-known {
    allow all;
}

error_page 500 502 503 504 /50x.html;
location = /50x.html {
    root /usr/share/nginx/html;
}   

}

  1. Modify the file ‘/usr/local/tomcat/server.xml’ of the Wiki adding the next lines:
<Valve className="org.apache.catalina.valves.RemoteIpValve" internalProxies="127\.0\.[0-1]\.1" remoteIpHeader="x-forwarded-for" requestAttributesEnab

  1. Modify the file ‘wiki.cfg’ and uncomment this two lines:

xwiki.home=https://your.domain.com/
wiki.url.protocol=https

With that should be enough :slight_smile:
@robertjr25 :white_check_mark:

1 Like