elsa-workflows / elsa-core

A .NET workflows library
https://v3.elsaworkflows.io/
MIT License
6.26k stars 1.15k forks source link

Elsa Studio v3 hosted behind a proxy. Hosting:BasePath does not seem implemented completely #4883

Open FritzAlex opened 7 months ago

FritzAlex commented 7 months ago

Hi, we are currently trying to get the elsaworkflows/elsa-studio-v3 docker image running behind a proxy and have set the Hosting:BasePath environment Variable to the BasePath behind the Proxy. For most of the requested resources it seemed to work, but not for the _framework/blazor.webassembly.js and the ElsaStudioWebAssembly.styles.css files.

Is there something on our end that we missed or is this a Bug?

glime-ai[bot] commented 7 months ago

To troubleshoot the issue you're experiencing with the elsaworkflows/elsa-studio-v3 Docker image running behind a proxy, there are a few things to consider:

  1. Base Path Configuration: Ensure that the Hosting:BasePath environment variable is set correctly in your Docker run command. This should reflect the base path that the application is accessed from behind the proxy.

  2. Proxy Configuration: Verify that your proxy is correctly configured to rewrite the URLs for the resources that are not loading. Some proxies require specific rules to handle URL rewrites for paths to static resources.

  3. Application Settings: Check if the application's settings, such as appsettings.json or wwwroot/appsettings.json, need to be updated to reflect the base path or other proxy-related configurations.

  4. Docker Image Version: Make sure you are using the latest version of the Docker image, as there might have been updates or bug fixes related to running behind a proxy.

  5. Blazor Configuration: Since the files _framework/blazor.webassembly.js and ElsaStudioWebAssembly.styles.css are specific to Blazor WebAssembly, you might need to check the Blazor configuration for handling static files and base paths. This can include settings in index.html or _Host.cshtml.

  6. Check for Known Issues: Look for any known issues or discussions on the official Elsa GitHub repository or forums that might relate to running the application behind a proxy.

If you've checked all the above and the issue persists, it could be a bug or a missing feature in the Elsa Dashboard's handling of base paths for static resources. In this case, you might want to raise an issue on the official Elsa GitHub repository or seek help from the community in the discussions section.

Since you mentioned that most resources are loading correctly, it suggests that the base path is partially working, but there might be specific static resources that are not respecting the base path setting. This could be due to how the Blazor framework handles static assets or a misconfiguration in the Docker image or the application itself.

If you provide more details about your proxy setup and the exact Docker run command you're using, I could offer more targeted advice.

FritzAlex commented 7 months ago

Hello again,

after further investigation the problem may be here that the @basePath Variable is not applied on that specific line. May that be the issue to the Problem?

sfmskywalker commented 7 months ago

Hey there, yes this might be the problem, although I need to try it to be sure. Although I don't have the bandwidth to try it right now, what I can do is apply the suggested change, since it won't break anyone anyway given that basePath is empty by default. Once the new image is available, you can give it a try and let us know your findings.

sfmskywalker commented 7 months ago

Once this build successfully completes, you should be able to pull the newest version of the image (be sure to do a docker pull before doing a run) and see if it helps.

FritzAlex commented 7 months ago

Hey, Thanks for the quick response. The direct error got fixed, but it seems to be a larger rabbithole after that. Now we get this error, seems to be a similar Origin.

Bildschirmfoto 2024-02-13 um 09 25 24
MIC-BO commented 2 months ago

hi @sfmskywalker and @FritzAlex, I faced the same issue and I fixed it with these steps:

  1. Add the base path to the Elsa server (Program.cs): image

  2. Add the FQDN to the _Host.cshtml belonging to Elsa server, all changed lines are marked in red: image

  3. In my case I use Nginx as a gateway, so I added a forwarding route: image

and voila, Elsa v3 running behind a proxy:

image

Of course it is better to pull these paths and URLs from the config, I left them static to depict the solution.