# N8N - using a different context path

**URL:** <https://community.n8n.io/t/n8n-using-a-different-context-path/15086>\
**Category:** Questions\
**Tags:** deployment\
**Created:** [June 22, 2022, 9:12am UTC](https://community.n8n.io/t/n8n-using-a-different-context-path/15086 "2022-06-22T09:12:54Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![aschuma](https://avatars.discourse-cdn.com/v4/letter/a/ac91a4/32.png) [@aschuma](https://community.n8n.io/u/aschuma)\
**Post date:** [June 22, 2022, 9:12am UTC](https://community.n8n.io/t/n8n-using-a-different-context-path/15086/1 "2022-06-22T09:12:54Z")

</div>

## Information on n8n setup

- n8n version: 0.178.0
- Database: Postgres
- Running n8n via **npm** on **Windows 2019 Server**

## My goal

I am retrying to setup multiple n8n instances on a single host. In addition a ssl reverse proxy should provide the SSL termination, e.g.

```auto
SSL reverse Proxy (https://www.example.com)
 |
 |--- N8N Instance 1 (https://www.example.com/n8n_default)
 |--- N8N Instance 2 (https://www.example.com/n8n_instance2)
 |--- N8N Instance 3 (https://www.example.com/n8n_instance3)

```

**Challenge 1** : Run multiple N8N instances on same host

- Seems to work by setting the USERDIR variable to a dedicated value for each instance, providing a different port via N8N\_PORT and using dedicated db schemas.

* * *

**Challenge 2** : Use different context path for each instance (but not yet using a SSL proxy)

- I tried the solution mentioned here [N8N as a subfolder with nginx - #5 by harshil1712](http://community.n8n.io/t/n8n-as-a-subfolder-with-nginx/7958/5), but without any success.
- N8N is starting fine, the js/css resources in the returned html page pointing to “/n8n\_default” (as expected), but N8N is still serving css and js resources using “/” as path

```auto
      "N8N_PORT" : 6678, 
      "N8N_PATH" : "/n8n_default/",
      "DOMAIN_NAME" : "localhost",
      "WEBHOOK_URL" : "http://localhost:6678/n8n_default",
      "VUE_APP_URL_BASE_API" : "http://localhost:6678/n8n_default",

```

```auto
<!DOCTYPE html><html lang="en">
<head><meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width,initial-scale=1">
<link rel="icon" href="/n8n_default/favicon.ico">
<script>window.BASE_PATH = "/n8n_default/";</script>
<title>n8n.io - Workflow Automation</title><link href="/n8n_default/js/chunk-2d2073c1.f0370751.js" rel="prefetch">
<link href="/n8n_default/js/chunk-2d22d3e6.388c0a4c.js" rel="prefetch"><link href="/n8n_default/js/chunk-4301fce8.d032a636.js" rel="prefetch"><link href="/n8n_default/js/chunk-b1e1f7c0.92d036f0.js" rel="prefetch"><link href="/n8n_default/css/app.3544aae5.css" rel="preload" as="style"><link href="/n8n_default/css/chunk-vendors.274eb558.css" rel="preload" as="style"><link href="/n8n_default/js/app.98057e67.js" rel="preload" as="script"><link href="/n8n_default/js/chunk-vendors.ec9c98e5.js" rel="preload" as="script"><link href="/n8n_default/css/chunk-vendors.274eb558.css" rel="stylesheet"><link href="/n8n_default/css/app.3544aae5.css" rel="stylesheet"></head><body><noscript><strong>We're sorry but the n8n Editor-UI doesn't work properly without JavaScript enabled. Please enable it to continue.</strong></noscript><div id="app"></div><script src="/n8n_default/js/chunk-vendors.ec9c98e5.js"></script><script src="/n8n_default/js/app.98057e67.js"></script></body></html>

```

**Any ideas which additional setting I should tweak ?**

* * *

**Challenge 3** : Wrap the stuff using a reverse proxy

- Not yet started, but I guess I will observe more suprises ☹

---

<div class="post-metadata">

**Author:** ![MutedJam](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/mutedjam/32/70851_2.png) [@MutedJam](https://community.n8n.io/u/MutedJam)\
**Post date:** [June 22, 2022, 12:56pm UTC](https://community.n8n.io/t/n8n-using-a-different-context-path/15086/2 "2022-06-22T12:56:02Z")

</div>

Hi @aschuma, welcome to the community and I am sorry to hear you’re having trouble here.

The [documentation](https://docs.n8n.io/hosting/environment-variables/#deployment) for `VUE_APP_URL_BASE_API` suggests this variable is only taken into account when building n8n:

> Used when building the n8n-editor-ui package manually to set how the frontend can reach the backend API.

So you might need to build a custom version of n8n as [described here](https://github.com/n8n-io/n8n/blob/master/CONTRIBUTING.md#development-setup). Tbh, this seems like like a lot of effort, especially when keeping these up to date.

So it seems much simpler to set up individual subdomains for each of your n8n instances (your third option) and just use the default path `/` for each (at least with nginx or caddy as the reverse proxy). Seeing you are using Windows Server make sure to check out this configuration advice from fellow community member @lublak if you want to use IIS:

> [@Reverse Proxy IIS](http://community.n8n.io/t/reverse-proxy-iis/3437/2):
>
> To work under iis you need disable response buffer threshold: Also the web.config is simpler: \<?xml version="1.0" encoding="UTF-8"?\> \<configuration\> \<system.webServer\> \<rewrite\> \<rules\> \<rule name="n8n" stopProcessing="true"\> \<match url=".\*" /\> \<action type="Rewrite" url="http://127.0.0.1:5678/{R:0}" appendQueryString="true" logRewrittenUrl="false" /\> \<conditions\> …

---

<div class="post-metadata">

**Author:** ![aschuma](https://avatars.discourse-cdn.com/v4/letter/a/ac91a4/32.png) [@aschuma](https://community.n8n.io/u/aschuma)\
**Post date:** [June 22, 2022, 3:38pm UTC](https://community.n8n.io/t/n8n-using-a-different-context-path/15086/3 "2022-06-22T15:38:18Z")

</div>

Hi MutedJam

Thank you for the valuable answer.

I thought already about using subdomains for the dedicated N8N instances. But in this special case I probably run into trouble to get dedicated certs or wildcard certificates. This is an other story ☹

What I do not get is, why it’s possible to specify an N8N\_PATH at all? In general I would assume, that this would change the context path globally. Probably I missed something in the doc. Could you clarify that?

Best wishes

---

<div class="post-metadata">

**Author:** ![MutedJam](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/mutedjam/32/70851_2.png) [@MutedJam](https://community.n8n.io/u/MutedJam)\
**Post date:** [June 23, 2022, 8:25am UTC](https://community.n8n.io/t/n8n-using-a-different-context-path/15086/4 "2022-06-23T08:25:40Z")

</div>

The idea is to run this behind a reverse proxy server, you can find some more background from our development team here on this GH issue:

> <https://github.com/n8n-io/n8n/issues/2651#issuecomment-1109399532>
>
> \*\*Describe the bug\*\*
> Since the last update (0.157.0) I can no longer access to …N8N due to 404 errors while fetching css and js resources. I'm runing N8N under \*\*mywebsite.xxx/n8n/\*\* but resources are being fetched from \*\*mywebsite.xxx/css or /js\*\*. 
> For the older versions, I set the environment variable \*\*N8N\_PATH\*\* to \*\*/n8n/\*\* and it was working fine.
> 
> \*\*To Reproduce\*\*
> Steps to reproduce the behavior:
> 1. Deploy latest N8N Image in Kubernetes with Nginx ingress controller
> 2. Set \*\*N8N\_HOST\*\* to \*\*mywebsite.xxx\*\*
> 3. Set \*\*N8N\_PATH\*\* to \*\*/n8n/\*\*
> 4. Try to access to N8N and check the network tab in your console
> 5. See error
> 
> \*\*Expected behavior\*\*
> Resources being fetch from \*\*mywebsite.xxx/n8n/css or /js\*\* based on the N8N\_PATH like previous versions.
> 
> \*\*Environment (please complete the following information):\*\*
> - OS: Official Docker image of N8N
> - n8n Version 0.157.0
> - Node.js Version: Official Docker image of N8N
> - Database system: SQLite
> - Operation mode: own

---

<div class="post-metadata">

**Author:** ![valya](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/valya/32/12320_2.png) [@valya](https://community.n8n.io/u/valya)\
**Post date:** [June 6, 2023, 4:18pm UTC](https://community.n8n.io/t/n8n-using-a-different-context-path/15086/5 "2023-06-06T16:18:37Z")

</div>

Hi @MutedJam ,

I’m also trying to move n8n to a subfolder. I set up the environment variable `VUE_APP_URL_BASE_API`, install, build and start n8n but I get:

 ![image](https://europe1.discourse-cdn.com/n8n/original/3X/c/c/cc0526f557710e1165b8c0a1e5282ba6accf5bab.png)

Do you have any advice? Thank you in advance!

---

<div class="post-metadata">

**Author:** ![Jon](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/jon/32/40174_2.png) [@Jon](https://community.n8n.io/u/Jon)\
**Post date:** [June 7, 2023, 7:51am UTC](https://community.n8n.io/t/n8n-using-a-different-context-path/15086/6 "2023-06-07T07:51:33Z")

</div>

Hey @valya,

Can you share your config so we can take more of a look? A 404 is fairly generic so it is going to come down to your config.
