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.

Static HTML file in public folder cannot be accessed in production build

See original GitHub issue

Is this a bug report?

No

Did you try recovering your dependencies?

Yes

Environment

Environment: OS: Linux 4.17 Node: 8.10.0 Yarn: 1.7.0 npm: 6.1.0 Watchman: Not Found Xcode: N/A Android Studio: Not Found

Steps to Reproduce

  1. Generate React project with npx create-react-app my-app
  2. Insert new index.html file in a subfolder in public. Mine is in public/home/index.html
  3. The above file path works in the development build, when I navigate to localhost:3000/home/. However, if I run a production build, I am no longer able to access this HTML file. Curiously, I’m able to access any other type of file, such as localhost:5000/home/js/random.js, and even if I change the name of index.html to index.htm, I’m able to navigate to it via localhost:5000/home/index.htm. It’s just the specific case of the HTML file extension that seems to be blocked by something.

Expected Behavior

I would hope to find a way to take advantage of the public directory to serve up my static HTML landing page. I wouldn’t necessarily call this a bug, but I’ve tried a bunch of webpack configurations, tried disabling the service worker, copywebpackplugin, and none of it really worked to allow me to visit http://mysite/home.

Any help is much appreciated!

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:9 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
Timercommented, Sep 23, 2018

Hmm, it sounds like an issue needs to be opened with serve to serve a file when there’s an exact match on the file system.

0reactions
stale[bot]commented, Nov 20, 2018

This issue has been automatically closed because it has not had any recent activity. If you have a question or comment, please open a new issue.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Using the Public Folder - Create React App
The public folder contains the HTML file so you can tweak it, for example, to set the page title. The <script> tag with...
Read more >
Is it possible to serve Static files with create-react-app from ...
Yes, you can place assets in the static folder. Docs: Using the Public Folder. You can reference the path in index.html with ...
Read more >
How to use files in public folder in ReactJS ? - GeeksforGeeks
The public folder contains static files such as index.html, ... Step 1: Create a React application using the following command:
Read more >
Support - Netlify Support Forums
Issue: In production, netlify is not picking up on any of my glb models or some images from my public folder. Some of...
Read more >
How to create a Static site public folder in Next.js? - Medium
With the public folder, you access everything in production or built time. ... You can add a verification HTML file inside the public...
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