#reverse proxy?
1 messages · Page 1 of 1 (latest)
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
@timid ferry do I need to use Nginx, or can I use the instance of caddy that comes with Appsmith?
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
Hello @dry flare,
Can you link us the posts you're referring to in the original message where this was mentioned?
@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
}
Where can you configure this Caddy file? I'm CE self-hosted.
@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?
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.
My example is a Caddyfile I wrote, that I attempt to merge with Appsmith's Caddy file at /tmp/appsmith/Caddyfile
@dry flare You can file a feature request with the link above.
Thank you for your continuous support and patience. You can track the GitHub issue that addresses the matter further. Our development team will be taking over from here.
We value your feedback and would appreciate hearing about your experience with our support team.
https://survey.frontapp.com/v2/09a400bf433bc9676d67/51d9ecfcf0e910ef196702d56a6bf36a