question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

request for "serve app under" configuration

See original GitHub issue

The Issue

Currently, no matter what you do with routes and such inside your app, the Webpack node app that does all the hot module reloading and linting and such always wants to serve assets rooted at /. This breaks when a development environment includes more than one interoperating React app sharing a URI path space.

The Proposed Solution

We would really like to be able to serve those assets from a configurable path. It would be nice to be able to specify in our package.json some setting that identified a “mount under” pathspec. I think we can be somewhat flexible about the exact behavior, so long as the asset links Webpack generates contain a configurable path prefix.

The Use Case

We’re using create-react-app to build two separate React applications. One application is our domain application. One application is a common user-and-organization management app. The user-and-organization management app is shared with other business units who are using completely separate stacks.

We’re still relatively early in the development process, and to date, we’ve been fine using different ports to route between these apps. However, a new set of requirements requires us to gather the two apps under a single domain name. The user-and-org app should be mounted under domain.name.here/account and the remainder of domain.name.here should serve the domain-specific app.

In production, this shouldn’t be a problem. We can emit a bundle that will have the right paths in it by using the homepage setting. We’ll stick both bundles onto a CDN; a load balancer will route the API endpoints, and everything should be fine.

In development, things are a little trickier. Webpack’s development app always wants to serve assets from /, and it writes all the asset links it emits to reference that path. We can handle getting requests with /account in them to the correct server, and we can write our user-and-org application to expect /account in front of all the routes, but we can’t talk Webpack into serving assets under /account – we could work around this problem – nor can we get Webpack to emit links to those assets under /account – and that problem we can’t work around.

Workarounds

We’ve talked about continuing to route by port in development, and just making all our link-generation logic environment sensitive.

We’ve talked about ejecting and writing our own Webpack config – we actually started down that path, but I don’t think we’ve reached its conclusion.

We’ve also pushed back a little harder on using domain names to separate the two apps; that has some upside and some downside, but it obviates this problem.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Reactions:7
  • Comments:22 (18 by maintainers)

github_iconTop GitHub Comments

4reactions
kellyrmilligancommented, Mar 23, 2017

opened a pr for this.

1reaction
Timercommented, Jan 10, 2018

We definitely want to go forward with this. Please consolidate all discussions into #1887. Thanks!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Configure apps - Azure App Service - Microsoft Learn
Learn to configure common settings for an App Service app. ... In the app's left menu, select Configuration > Application settings.
Read more >
Now Mobile App Configuration | My Requests, Service ...
Demonstrates configuring service catalogs, knowledge bases, and My Requests in the Now Mobile App.This video applies to UI16, the latest ...
Read more >
Enable Self Service request feature - Okta Documentation
In the Admin Console, go to Applications > Self Service. Click Settings. In User App Requests, click Edit to change App Catalog Settings....
Read more >
Set Up an Approval Process for Service Request Applications
Configure an automated process to track and approve service request applications. Create Locations for Location Access PermitsWhen site users request a pe.
Read more >
Server-side rendering (SSR) with Angular Universal
In practice, you'll serve a static version of the landing page to hold the user's attention. At the same time, you'll load the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found