#reverse proxy?

1 messages · Page 1 of 1 (latest)

dry flare
#

With self hosting, I've seen a few posts about using a reverse proxy to hide the page ID at the end of URLs. Does anyone have an example of this? I tried to set it up, but so far I'm just seeing and Appsmith 404 page.

timid ferryBOT
#

Hello! I'm AppyBot, your Appsmith support assistant.

Using a reverse proxy to hide the page ID in URLs for a self-hosted Appsmith instance is a common practice. However, it's important to ensure that the reverse proxy is configured correctly to rewrite URLs without breaking the routing handled by Appsmith.

Here?s a basic example using Nginx as a reverse proxy. This configuration assumes you want to rewrite URLs to make them cleaner:

server {
    listen 80;

    server_name your-domain.com;

    location / {
        proxy_pass http://localhost:8080; # Change this to the address where Appsmith is running
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;
    }

    # Example of a URL rewrite rule
    # This rule needs to be adjusted based on your specific requirements
    location /myapp {
        rewrite ^/myapp/(.*)$ /applications/$1 last;
        proxy_pass http://localhost:8080;
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "upgrade";
        proxy_set_header Host $host;
        proxy_cache_bypass $http_upgrade;
    }
}

This configuration includes a basic proxy setup and an example of a rewrite rule. You need to adjust the rewrite rule (rewrite ^/myapp/(.*)$ /applications/$1 last;) according to how you want to structure your URLs.

Make sure that the proxy_pass and other proxy headers are correctly set to ensure that Appsmith receives the necessary information to process requests correctly.

If you continue to see a 404 page, it might be due to the rewrite rules not matching the intended URLs or the proxy not forwarding requests correctly. Double-check your configurations and ensure that the paths align with what Appsmith expects.

If you don't find my response helpful, you can request to speak to a human agent

dry flare
#

@timid ferry do I need to use Nginx, or can I use the instance of caddy that comes with Appsmith?

timid ferryBOT
#

Hello again! You can definitely use the Caddy server that comes with Appsmith for reverse proxy configurations, including URL rewriting. Caddy is quite flexible and can be configured to handle URL rewrites similarly to Nginx.

Here?s an example of how you might set up a Caddyfile to rewrite URLs to hide the page ID:

your-domain.com {
    reverse_proxy localhost:8080 {
        header_up Host {host}
        header_up X-Real-IP {remote}
        header_up X-Forwarded-For {remote}
        header_up X-Forwarded-Proto {scheme}
    }

    # Example of a URL rewrite rule
    # Adjust the rule based on your specific requirements
    @rewritePath {
        path /myapp/*
    }
    rewrite @rewritePath /applications/{path}
}

This configuration sets up Caddy to reverse proxy to a local Appsmith instance running on port 8080 and includes an example of how to rewrite URLs. The @rewritePath directive is used to match paths that should be rewritten, and the rewrite directive changes the path to what Appsmith expects.

Make sure to adjust the paths and port according to your setup. If you encounter any issues with 404 errors, it might be due to the rewrite rules not correctly matching or not properly rewriting to the expected Appsmith URLs. Double-check your configuration and ensure that the paths are correctly aligned with your Appsmith application structure.

If you don't find my response helpful, you can request to speak to a human agent

timid ferryBOT
#

Hello @dry flare,

Can you link us the posts you're referring to in the original message where this was mentioned?

dry flare
# timid ferry Hello <@1213610386033745953>, Can you link us the posts you're referring to in ...

@timid ferry can you explain why I get a 404 error with the following caddy configuration:

mysite.test:80 {
  reverse_proxy localhost:8080 {
    header_up Host {host}
    header_up X-Real-IP {remote}
    #header_up X-Forwarded-For {remote}
    #header_up X-Forwarded-Proto {scheme}
  }

  # Rewrite the URL path
  @dashboardPath {
    path /dashboard
  }
  rewrite @dashboardPath /app/my-first-application/dashboard-669832405645aa229d6e2cb9

  # Proxy requests to the upstream service
  # reverse_proxy http://localhost
}
still hull
#

Where can you configure this Caddy file? I'm CE self-hosted.

timid ferryBOT
#

@dry flare The bot was disabled when we replied to the thread. Are you able to provide links to the posts you're mentioning if you're still facing this issue?

Could you also help us file a feature request using this link?

https://github.com/appsmithorg/appsmith/issues/new?assignees=Nikhil-Nandagopal&labels=Enhancement&projects=&template=--feature-request.yaml&title=[Feature]%3A+

Please add details about your use case, how this feature would help you, and give an example if possible. Once you file the GitHub issue, please share the link to it with us, so we can forward it to our development team.

GitHub

GitHub is where people build software. More than 100 million people use GitHub to discover, fork, and contribute to over 420 million projects.

dry flare
timid ferryBOT