Skip to content

Add homepage example without the full domain#11082

Open
camjackson wants to merge 1 commit into
react:mainfrom
camjackson:master
Open

Add homepage example without the full domain#11082
camjackson wants to merge 1 commit into
react:mainfrom
camjackson:master

Conversation

@camjackson
Copy link
Copy Markdown

@camjackson camjackson commented Jun 8, 2021

Consider 3 different possibilities for where an app will be deployed:

  1. Deploying to just a single domain and path (e.g. always example.com/my-app)
  2. Deploying to any arbitrary domain and path (e.g. example.com/my-app but also random.com/blah)
  3. Deploying to multiple domains but always the same path (e.g. example.com/my-app and test.example.com/my-app)

Scenario 1 is well-documented at "Deployment - Building for relative paths":

  "homepage": "http://mywebsite.com/relativepath",

Scenario 2 is well-documented at Deployment - Serving the Same Build from Different Paths, including the caveat that it breaks client-side routing:

  "homepage": ".",

Scenario 3 does not have a documented solution, despite it being the most common one in my experience. As far as I can tell, the following configuration works perfectly well:

  "homepage": "/my-app",

But after much searching I haven't seen anywhere on the internet that mentions the ability to specify homepage with just a path and no domain.

This PR adds that example to the docs. Here's how it looks:

Screen Shot 2021-06-09 at 8 54 20 am

@facebook-github-bot
Copy link
Copy Markdown

Hi @camjackson!

Thank you for your pull request and welcome to our community.

Action Required

In order to merge any pull request (code, docs, etc.), we require contributors to sign our Contributor License Agreement, and we don't seem to have one on file for you.

Process

In order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA.

Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with CLA signed. The tagging process may take up to 1 hour after signing. Please give it that time before contacting us about it.

If you have received this in error or have any questions, please contact us at cla@fb.com. Thanks!

@facebook-github-bot
Copy link
Copy Markdown

Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Facebook open source project. Thanks!

@DhruveshPanchal
Copy link
Copy Markdown

@camjackson I am facing issue for Scenario 2,

I tried setting the homepage to "." but this ends in a situation where:

www.myApp.com works as expected which is good

www.anotherSite.com/myApp does not work at all -> white page with error showing enter image description here
image

Do you have any solution for this case?

@stale
Copy link
Copy Markdown

stale Bot commented Jan 8, 2022

This pull request has been automatically marked as stale because it has not had any recent activity. It will be closed in 5 days if no further activity occurs.

@stale stale Bot added the stale label Jan 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants