wiki icon indicating copy to clipboard operation
wiki copied to clipboard

Wiki.js behind corporate web proxy

Open SharkProgramming opened this issue 7 years ago • 6 comments

Question I have to install wiki.js behind a corporate web proxy server ,but node.js doesn't want to use the environnement variable defined for http_proxy . Is there a possibility to install package like Axios or other solution in order to have internet access througth this proxy ?

Host Info:

  • OS: Ubuntu 18.04.3
  • Wiki.js version: 2.0.0-rc.17
  • Database engine: MariaDB 10.3.18

SharkProgramming avatar Nov 06 '19 10:11 SharkProgramming

Proxy is not supported yet. You can follow this feature request: https://wiki.js.org/feedback/p/enable-http-proxy-use

NGPixel avatar Nov 13 '19 23:11 NGPixel

I figured out a work around for this: use https://github.com/rofl0r/proxychains-ng with LD_PRELOAD. In my case, I am using docker-compose.

You have to:

  • incorporate the compiled proxychains4.so in to /lib/ and set the environment variable
  • create your own proxychains.conf

Here is an example: Dockerfile

FROM requarks/wiki:2

USER root

ADD ./libproxychains4.so /lib/

RUN echo -e 'localnet 192.168.0.0/255.255.0.0\n\
[ProxyList]\n\
http <YOUR PROXY> <PROXY PORT>\n'\
> /etc/proxychains.conf

USER node

docker-compose.yaml

version: "3"
services:

  db:
    image: postgres:11-alpine
    environment:
      POSTGRES_DB: wiki
      POSTGRES_PASSWORD: wikijsrocks
      POSTGRES_USER: wikijs
    restart: unless-stopped
    volumes:
      - /data/wikijs/postgresql/data:/var/lib/postgresql/data

  wiki:
    image: wikijs-proxychains:1
    depends_on:
      - db
    environment:
      DB_TYPE: postgres
      DB_HOST: db
      DB_PORT: 5432
      DB_USER: wikijs
      DB_PASS: wikijsrocks
      DB_NAME: wiki
      LD_PRELOAD: /lib/libproxychains4.so
    restart: unless-stopped
    ports:
      - "80:3000"

rockmenjack avatar Apr 27 '20 03:04 rockmenjack

I figured out a work around for this: use https://github.com/rofl0r/proxychains-ng with LD_PRELOAD. In my case, I am using docker-compose.

You have to:

  • incorporate the compiled proxychains4.so in to /lib/ and set the environment variable
  • create your own proxychains.conf

Here is an example: Dockerfile

FROM requarks/wiki:2

USER root

ADD ./libproxychains4.so /lib/

RUN echo -e 'localnet 192.168.0.0/255.255.0.0\n\
[ProxyList]\n\
http <YOUR PROXY> <PROXY PORT>\n'\
> /etc/proxychains.conf

USER node

docker-compose.yaml

version: "3"
services:

  db:
    image: postgres:11-alpine
    environment:
      POSTGRES_DB: wiki
      POSTGRES_PASSWORD: wikijsrocks
      POSTGRES_USER: wikijs
    restart: unless-stopped
    volumes:
      - /data/wikijs/postgresql/data:/var/lib/postgresql/data

  wiki:
    image: wikijs-proxychains:1
    depends_on:
      - db
    environment:
      DB_TYPE: postgres
      DB_HOST: db
      DB_PORT: 5432
      DB_USER: wikijs
      DB_PASS: wikijsrocks
      DB_NAME: wiki
      LD_PRELOAD: /lib/libproxychains4.so
    restart: unless-stopped
    ports:
      - "80:3000"

was you completed ?

songhanpoo avatar Jun 05 '20 09:06 songhanpoo

@SharkProgramming, @rockmenjack and @songhanpoo Besides the proxychain solution, you may also sideload the localization files. Please take a look at my answer on the stackoverflow.

SayidHosseini avatar Nov 07 '20 14:11 SayidHosseini

I figured out a work around for this: use https://github.com/rofl0r/proxychains-ng with LD_PRELOAD. In my case, I am using docker-compose. You have to:

  • incorporate the compiled proxychains4.so in to /lib/ and set the environment variable
  • create your own proxychains.conf

Here is an example: Dockerfile

FROM requarks/wiki:2

USER root

ADD ./libproxychains4.so /lib/

RUN echo -e 'localnet 192.168.0.0/255.255.0.0\n\
[ProxyList]\n\
http <YOUR PROXY> <PROXY PORT>\n'\
> /etc/proxychains.conf

USER node

docker-compose.yaml

version: "3"
services:

  db:
    image: postgres:11-alpine
    environment:
      POSTGRES_DB: wiki
      POSTGRES_PASSWORD: wikijsrocks
      POSTGRES_USER: wikijs
    restart: unless-stopped
    volumes:
      - /data/wikijs/postgresql/data:/var/lib/postgresql/data

  wiki:
    image: wikijs-proxychains:1
    depends_on:
      - db
    environment:
      DB_TYPE: postgres
      DB_HOST: db
      DB_PORT: 5432
      DB_USER: wikijs
      DB_PASS: wikijsrocks
      DB_NAME: wiki
      LD_PRELOAD: /lib/libproxychains4.so
    restart: unless-stopped
    ports:
      - "80:3000"

was you completed ?

Hello,

I need to use this option since I'm using Azure AI Serarch and it needs to connect to the exterior, but I cant get it to work with proxychains, can you give som clearer instructions?

Thanks in advance.

corrreia avatar Feb 02 '24 16:02 corrreia

My solution was to create a custom container image like so:

FROM requarks/wiki:2

RUN mkdir /wiki/data/sideload
RUN rm /wiki/config.yml

COPY ./sideload /wiki/data/sideload
COPY ./config.yml /wiki

with:

port: 3000
bindIP: 0.0.0.0
db:
  type: $(DB_TYPE)
  host: '$(DB_HOST)'
  port: $(DB_PORT)
  user: '$(DB_USER)'
  pass: '$(DB_PASS)'
  db: $(DB_NAME)
  storage: $(DB_FILEPATH)
  ssl: $(DB_SSL)
ssl:
  enabled: $(SSL_ACTIVE)
  port: 3443
  provider: letsencrypt
  domain: $(LETSENCRYPT_DOMAIN)
  subscriberEmail: $(LETSENCRYPT_EMAIL)
logLevel: $(LOG_LEVEL:info)
logFormat: $(LOG_FORMAT:default)
ha: $(HA_ACTIVE)
offline: true

ebousse avatar Dec 09 '24 11:12 ebousse