ReactJS App Subdomain

I have Coder working well with everything in my stack (Java and ReactJS), but the only issue I'm having is when trying to access a part of my ReactJS app that exists under a subdomain. For example. when running locally I'm able to do localhost:5173 to get to a "Control Panel" version of the app, but then to get to another part I have to do subdomain.localhost:5173. I have no problems with the root (Control Panel) but I can't figure out how to get the subdomains to resolve. Not sure what config to post here since I'm new to Coder, but I can supply whatever is needed.
7 Replies
Codercord
Codercord3d ago
Codercord
Codercord3d ago
<#1369433180527923402>
Category
Help needed
Product
code-server
Platform
Windows
Logs
Please post any relevant logs/error messages.
zounce
zounce3d ago
Just to clarify, you're running something like coder port-forward <ws> --tcp 5173:5173? and localhost:5173 works fine, but not subdomain.localhost:5173? I would expect that to just work, so this might be a bug (actually, if the app running on your workspace is programming the localhost subdomain by modifying /etc/hosts, then it makes sense this doesn't work out the box) Do you know how your react app programs subdomain.localhost to point to your server?
whitesoup12
whitesoup12OP2d ago
To clarify, I'm not actually using localhost to access my apps. I'm. using my coder URL (eg. ****.try.coder.app:5173). It's when I try to access subdomain.****.try.coder.app that I have the issue. The ReactJS app actually just grabs the subdomain and displays a different section of the app, so technically not a real subdomain. As for coder port-forward, I have yet to get that to work. My workspace name for UI is RemoteFalconUI, but when I try to port forward, I always end up with an error. coder port-forward RemoteFalconUI --tcp 5173:5173 Encountered an error running "coder port-forward", see "coder port-forward --help" for more information error: Resource not found or you do not have access to this resource Update. I was finally able to get port-forward working. I tried a multitude of workspace names before finding out coder list will give the workspaces the CLI uses (which was user/workspace). With port-forward working I can now access all parts of the app.
zounce
zounce17h ago
That's good to hear! Was it just that the workspace you were trying to port-forward owned by someone else?
Phorcys
Phorcys10h ago
that makes sense, also regarding the port-forwarding I would recommend configuring your own domain instead of relying on try.coder.app! and yeah, we don't support sub-subdomains for the port-forwarding as we're already using a wildcard domain for port-forwarding
whitesoup12
whitesoup12OP7h ago
No, I own it. I was just using the wrong workspace name.

Did you find this page helpful?