Skip to content

Change BaseURL of Appwrite #1003

Closed
Closed

Description

@Errichamonda

I want to deploy my AppWrite instance under a subpath of my domain (www.example.com/appwrite). I need this because I already have Apache2 with mod_proxy handling all my requests from port 80 and 443 and redirecting the user to different port based on the url.

I sorta got it working but all the links on the page are broken. Not redirecting my custom url.

Activity

  1. eldadfux commented on Mar 20, 2021

    @eldadfux
    Member

    We don't have support for subpaths. I think the API should work (haven't tested it), but I guess the console will have a lot of broken assets and links. The best way to run Appwrite on an existing setup would probably be on a subdomain or a non-default port.

  2. DevDorrejo commented on Mar 22, 2021

    @DevDorrejo

    using reverse proxy, will made a lot of the function fails, for example storage, when you try to upload a file will fail.

  3. iSplasher commented on Mar 22, 2021

    @iSplasher

    Wow this issue just bit me hard.
    I wish I knew this before investing my time with this library.

  4. DevDorrejo commented on Mar 22, 2021

    @DevDorrejo

    Wow this issue just bit me hard.
    I wish I knew this before investing my time with this library.

    one think i havent try is configuring the web sockets, to test if the webhook and the other function that fail will work.

  5. iSplasher commented on Mar 22, 2021

    @iSplasher

    I am trying to go with the reverse proxy route and see if i can get it working before i completely give up the idea of using this. I don't use functions yet, I just need the console to work and display properly.

  6. DevDorrejo commented on Mar 22, 2021

    @DevDorrejo

    I am trying to go with the reverse proxy route and see if i can get it working before i completely give up the idea of using this. I don't use functions yet, I just need the console to work and display properly.

    are you using docker or docker compose?, mine isnt working T-T

  7. iSplasher commented on Mar 22, 2021

    @iSplasher

    Yes I am using docker compose with NGINX. I couldn't get it to work.
    I am using NextJS, I will now try to proxy the requests from the client to appwrite via an api route.

  8. DevDorrejo commented on Mar 22, 2021

    @DevDorrejo

    Yes I am using docker compose with NGINX. I couldn't get it to work.
    I am using NextJS, I will now try to proxy the requests from the client to appwrite via an api route.

    try this on you vhost

        ProxyRequests Off
        ProxyPreserveHost On
        ProxyPass / http://127.0.0.1:9001/
        ProxyPassReverse / http://127.0.0.1:9001/
        #SSLProxyEngine on
    
        <Proxy *>
            Require all granted
        </Proxy>
    
        # Websocket tracker
        RewriteEngine On
        RewriteCond %{HTTP:Upgrade} websocket [NC]
        RewriteRule /(.*) ws://127.0.0.1:9001/$1 [P,L]
    
    
  9. iSplasher commented on Mar 23, 2021

    @iSplasher

    I ended up proxying the requests through the webserver

    import NextConnect from "next-connect";
    const { createProxyMiddleware } = require("http-proxy-middleware")
    
    export const config = {
        api: {
            bodyParser: false,
        },
    };
    
    
    const handler = NextConnect()
        .use(createProxyMiddleware({
            target: 'http://appwrite',
            changeOrigin: true,
            pathRewrite: {
                '^/api/backend/': '/v1/',
            },
        }))
    
    export default handler
    

    This is for client sdk requests. Later on I might do the same for the console where I will use regex to replace all urls in the response from appwrite. Unless the maintainers implement baseurl change first of course. It seems like such an essential thing for a backend service, still can't fathom it hasn't been there yet.

  10. alexweininger commented on Aug 10, 2021

    @alexweininger
    Contributor

    This would be really nice to have. I would like to run Appwrite and my frontend on the same domain easily. And just have Appwrite be located at www.example.com/api or something similar.

  11. eldadfux commented on Feb 22, 2024

    @eldadfux
    Member

    As mentioned on #5430 this will be a huge lift for us and doesn't seem to be worth the effort vs the benefit. Our official recommendation for hosting Appwrite on the same server with other apps is to use a subdomain.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions