Run JetBrains Hub in a subdomain in a subfolder with Apache

163 views Asked by At

I am using JetBrains tools to manage a team. Using Apache to manage my domains/subdomains. I have a sub domain named dev.sepidarr.ir which is responsible as the main entry point of my development environment.

dev.sepidarr.ir.conf

<VirtualHost *:80>

  DocumentRoot /home/neacodin/domains/dev.sepidarr.ir/
  DirectoryIndex index.html

  <Directory "/home/neacodin/domains/dev.sepidarr.ir">
    Options Indexes FollowSymLinks MultiViews
    AllowOverride All
    Require all granted
  </Directory>

  ServerName dev.sepidarr.ir
  ServerAlias www.dev.sepidarr.ir

  RewriteEngine on
  RewriteCond %{SERVER_NAME} =www.dev.sepidarr.ir [OR]
  RewriteCond %{SERVER_NAME} =dev.sepidarr.ir
  RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]

</VirtualHost>

I want to have each JetBrains' tools running in a different url, for example I need upsource to run as dev.sepidarr.ir/upsource and hub in dev.sepidarr.ir/hub.

Based on the official JetBrains tutorial about how to setup a reverse proxy server, I have created a .conf file for hub as follow.

<VirtualHost *:80>

  ServerName dev.sepidarr.ir

  DefaultType none

  RewriteEngine on
  AllowEncodedSlashes on

  RewriteCond %{QUERY_STRING} transport=polling
  RewriteRule /(.*)$ http://localhost:8110/$1 [P]

  ProxyRequests off
  ProxyPreserveHost On

  ProxyPass /hub/ http://localhost:8110/hub
  ProxyPassReverse /hub/ http://localhost:8110/hub

</VirtualHost>

The problem is when I navigate to dev.sepidarr.ir it works fine. But when I try to open dev.sepidarr.ir/hub I get 404 Not Found.

I have also configured hub to run with a custom base-url with the following command.

hub.sh configure--listen-port 8110 --base-url https://dev.sepidarr.ir/hub

But nothing changed.

1

There are 1 answers

0
mamsoudi On BEST ANSWER

Simply use this:

<VirtualHost *:80>

ServerName dev.sepidarr.ir

... REST OF CONFIGS ...

<Location /hub>
    ProxyPass http://localhost:8110/hub
    ProxyPassReverse http://localhost:8110/hub
    Order allow,deny
    Allow from all
</Location>

</VirtualHost>

Now you can open dev.sepidarr.ir/hub and it shows {your_server_id/localhost}:8110/hub instead.

It's possible to add as much Location directive as you want.