deiucanta / chatpad

Not just another ChatGPT user-interface!
https://chatpad.ai
GNU Affero General Public License v3.0
1.33k stars 252 forks source link

Add support for reverse proxy #102

Open T3rm1 opened 7 months ago

T3rm1 commented 7 months ago

Self hosting is currently only possible if you don't have a path in the url because all links are absolute. This makes it impossible to use a reverse proxy to map to e.g. https://www.example.com/chatpadai/ Please add support for this. You might want to take a look at the documentation of the base tag.

zer0ish commented 6 months ago

I'm behind a reverse proxy and have no issues.

Pfsense for router with Cloudflare, server is unraid and using Nginx Proxy Manager. I use ai.mydomain.net where mydomain.net is the main website. Also had no issues using HAProxy on pfsense.

T3rm1 commented 6 months ago

What you do is something different. Of course it works behind a reverse proxy and a separate sub domain. But it won't work if you require a non root path.

ItzDerock commented 5 months ago

@T3rm1 Are you able to see if my PR fixes your issue? My PR adds an environment variable called BASEPATH that can be set, for example, to /chatpadai. This will update the site <base> tag and lets react router know of the new basepath.

It will not serve the files for you under the new basepath though, you will have to configure a reverse proxy to do that for you. Let me know if this is a problem, and I can make it update the container's webserver to serve under the specified base path.

T3rm1 commented 5 months ago

I checkout out your branch and tested it but it doesn't work. JS and CSS files are sill requested from root path which won't work.