May I know how/where I should change if using reverse proxy?

In my case, my nginx reverse proxy config is:

wiki.ckc.im -> Nginx -> Xwikihost:8080/wiki

location / {
    proxy_pass http://10.0.2.3:8080/xwiki/;
}

And my config file (/xwiki/WEB-INF/xwiki.cfg) is changed as following:

#-# xwiki.home=http://wiki.mycompany.net:8080/
xwiki.home=http://wiki.ckc.im/

Tried both / and empty
xwiki.webapppath=

And I found few location still represent /xwiki/…

developerShortcutsRestCall("/xwiki/rest/currentuser/properties/usertype/next",

Then I cannot use Edit and got 404:

jquery.js:9175 GET https://wiki.ckc.im/xwiki/rest/wikis/xwiki/spaces/Main/pages/WebHome?timestamp=1611659359218 404
send @ jquery.js:9175
ajax @ jquery.js:8656
n. @ jquery.js:8807
getJSON @ jquery.js:8788
reload @ InplaceEditing?language=en&docVersion=1.1:9
z @ InplaceEditing?language=en&docVersion=1.1:14
(anonymous) @ jquery.js:3366
i @ jquery.js:3187
fireWith @ jquery.js:3317
(anonymous) @ jquery.js:3373
i @ jquery.js:3187
fireWith @ jquery.js:3317
(anonymous) @ jquery.js:3373
i @ jquery.js:3187
fireWith @ jquery.js:3317
z @ jquery.js:8757
(anonymous) @ jquery.js:9123
load (async)
send @ jquery.js:9142
ajax @ jquery.js:8656
n. @ jquery.js:8807
getJSON @ jquery.js:8788
lock @ InplaceEditing?language=en&docVersion=1.1:9
p @ InplaceEditing?language=en&docVersion=1.1:12
n @ InplaceEditing?language=en&docVersion=1.1:12
editPage @ InplaceEditing?language=en&docVersion=1.1:28
(anonymous) @ InplaceEditing?language=en&docVersion=1.1:30
execCb @ require.min.js?r=1:5
check @ require.min.js?r=1:5
enable @ require.min.js?r=1:5
init @ require.min.js?r=1:5
(anonymous) @ require.min.js?r=1:5
setTimeout (async)
req.nextTick @ require.min.js?r=1:5
s @ require.min.js?r=1:5
requirejs @ require.min.js?r=1:5
(anonymous) @ InplaceEditing?language=en&docVersion=1.1:30
dispatch @ jquery.js:4737
r.handle @ jquery.js:4549

Am I somewhere wrong? Or could anyone tell me how actually to do?

Thanks

Did you read the documentation about this configuration?

Yes, @pdwalker
I saw it, but it seems all example are / (root) to / (root) or /xwiki/ to /xwiki/
and even hidden /bin

I am confusing if I front would like to use hostname/bin/ directly then proxy_pass to hostname:8080/wiki and wondering is it will be work?

I referred by this to install:

I actually not familiar with Tomcat? is it same also like Apache? is there a default site config? and is /xwiki.cfg would be consider like a virtual host config?

Thanks

Let’s break it down and try to understand what exactly it is you want to accomplish and what your real needs actually are?

First of all, why do you want to use a proxy? Why don’t you just serve the wiki from tomcat directly? (yes, you may have perfectly valid reasons for doing this - but I need to understand what they are)

Second - what are you doing to the urls? Do you want to use the default xwiki urls? If so, then configuring the proxy is relatively simple. Do you want a different url to appear? If so, then it gets a bit tricker as you have to rewrite the urls sent to and from the proxy. Not impossible, but it does take a bit more thought.

For example I have a wiki behind an apache proxy. I am using a proxy because the webserver is doing two things; (a) supporting multiple vhosts and (b) provides SSL termination. If I didn’t need easy vhost support, I’d just run without a proxy. Tomcat can also handle SSL, but it’s much easier to set up with apache - especially with multiple vhosts.

So my urls look like https://example.com/xwiki/bin/view/Main/ This is unchanged.

My vhost configuration looks like:

<Location "/xwiki">
        ProxyPreserveHost On
        RemoteIPHeader X-Forwarded-For
        ProxyPass  http://127.0.0.1:8080/xwiki/
        ProxyPassReverse http://127.0.0.1:8080/xwiki/
</Location>

Simple and straight forward.

However, if you want your urls to look different, then you will need to change the ProxyPass and ProxyPAssReverse settings to handle the remapping for every request.

Thanks for clarified points to me

First one is we need to use reverse proxy to share same public IP to expose some internal web services, xwiki is our one of all and we want to deploy SSL thru the reverse to centralised management; So we don’t direct to use Tomcat serve user

Second, yes with handle url: domain/bin/Main -> 192.168.1.1:8080/xwiki/bin/Main (Only hide /xwiki/ path for frontend then pass original to handle as well)
Just like simple, I am stuck at handle resources handling only (basically work open web, but some features like edit button still present /xwiki/ path)

for you showed me config, I need to figure out ProxyPass and ProxyPassReverse

I will have a try again

Thank you very much :slight_smile:

I just thought I’d give this a try myself to see if I could accomplish it as easy as I thought it could be, and I wasn’t able to do it.

Apparently, it’s not as simple as I thought, and I don’t have time to dig into it more.

This documentation may hold the key to your url mapping problem:

Good Luck!

1 Like

I’m new to use java web, not sure is it any reload compile/config action

suppose xwiki.webapppath= set as empty, the post URL also be root (/) not (/wiki)
but I see some still route /wiki like edit button some admin page
I only just want to figure out this

Defiantly thanks your help and tried :smile:

Updated (also for another similar user):
seemly resolved by changed the following, but not sure any leaving:
xwiki.virtual.usepath=0

default is commented and suppose as 1

#-# How virtual wikis are mapped to different URLs.
#-# If set to 0, then virtual wikis have different domain names, in the format http://wikiname.myfarm.net/.
#-# If set to 1 (the default), then the domain is common for the entire farm, but the path contains the wiki
name,
#-# in the format http://myfarm.net/xwiki/wiki/wikiname/.
#-# Note that you can configure the "/wiki/" part with xwiki.virtual.usepath.servletpath property.
xwiki.virtual.usepath=0