Issues with Serving App on reverse proxy Subfolder #4302
-
Hi everyone, My app is deployed in a container and all traffic is through a reverse proxy. The proxy maps "http://myhost.com/subfolder" to my container's root level. Essentially the app thinks it's running at the top level, but is actually running in a subfolder. This causes issues as the app needs to request certain resources but doesn't know it has to insert "subfolder" into the URLs. Note that the particular "subfolder" is not known at compile time, so needs to be set at runtime. In particular this has led to the following issues:
I was able to hack a fix for the first issue, and I can live without using if I need to but the server function issue seems intractable. I tried changing the I've poured through the help files but they don't seem to help in my particular deployment needs. I'm hoping there is a more straightforward solution I haven't considered. Essentially I need to prepend my server function calls URL at runtime. Please let me know if there is a solution, or if there's a repo with a similar setup I can learn from. Many thanks. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 7 replies
-
For the hydration mismatch: I assume this is due to the router. The For server functions: Have you tried using I have never used any of these in production so sorry for any inaccuracies. And let me know if you run into trouble using them. |
Beta Was this translation helpful? Give feedback.
For the hydration mismatch: I assume this is due to the router. The
Router
component has abase
prop that you should be able to set tosubfolder
.For server functions: Have you tried using
set_server_url
to set the full path of the server? For example if you callset_server_url("http://myhost.com/subfolder")
it should call all server functions relative to that path, rather than to/
. (If you need to build aString
to get it at runtime you can useString::leak()
to convert that into&'static str
)I have never used any of these in production so sorry for any inaccuracies. And let me know if you run into trouble using them.