Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Need to add "index.html" to make dev server work #603

Closed
sebelga opened this issue Apr 25, 2018 · 14 comments
Closed

Need to add "index.html" to make dev server work #603

sebelga opened this issue Apr 25, 2018 · 14 comments
Labels
status: needs more information There is not enough information to take action on the issue.

Comments

@sebelga
Copy link
Contributor

sebelga commented Apr 25, 2018

Hi,

In my dev environement I need to add "/index.html" to

  • root (ex: localhost:3000/index.html)
  • blog (ex: localhost:3000/blog/index.html)

Otherwise I get a server timeout error (the page does not defaults to "index.html").

Any idea why that might be happening?
Cheers.

@JoelMarcey JoelMarcey added the status: needs more information There is not enough information to take action on the issue. label Apr 25, 2018
@JoelMarcey
Copy link
Contributor

@sebelga Hi. Can you provide more details?

  • What version of Docusaurus are you using (npm outdated docusaurus from the website dir).
  • Are you on Windows, OS X, Linux?
  • Can you provide a link to your siteConfig.js file?

@sebelga
Copy link
Contributor Author

sebelga commented Apr 26, 2018

Hi @JoelMarcey

I have version 1.0.1 of "docusaurus-init" and version "1.0.14" of "docusaurus" in my project node_modules.
I am on Windows 7 64-bit

I can't provide a link as the repo is not public but here is my siteConfig.js (I only made update of some props and commented stuff)

/**
 * Copyright (c) 2017-present, Facebook, Inc.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */

// See https://docusaurus.io/docs/site-config.html for all the possible
// site configuration options.

/* List of projects/orgs using your project for the users page */
const users = [
  // {
  //   caption: 'User1',
  //   image: '/test-site/img/docusaurus.svg',
  //   infoLink: 'https://www.facebook.com',
  //   pinned: true,
  // },
];

const siteConfig = {
  title: 'eUI Documentation' /* title for your website */,
  tagline: 'All you ever wanted to know about eUI',
  url: 'https://eui.ec.eu' /* your website url */,
  baseUrl: '/' /* base url for your project */,
  // For github.io type URLs, you would set the url and baseUrl like:
  //   url: 'https://facebook.github.io',
  //   baseUrl: '/test-site/',

  // Used for publishing and more
  projectName: 'eUI',
  organizationName: 'European Commission',
  // For top-level user or org sites, the organization is still the same.
  // e.g., for the https://JoelMarcey.github.io site, it would be set like...
  //   organizationName: 'JoelMarcey'

  // For no header links in the top nav bar -> headerLinks: [],
  headerLinks: [
    {doc: 'basics-getting-started', label: 'Docs'},
    // {doc: 'doc4', label: 'API'},
    {page: 'help', label: 'Help'},
    // {blog: true, label: 'Blog'},
  ],

  // If you have users set above, you add it here:
  // users,

  /* path to images for header/footer */
  headerIcon: 'img/ec-logo.svg',
  footerIcon: 'img/eui-logo.svg',
  favicon: 'img/favicon.ico',

  /* colors for website */
  colors: {
    primaryColor: '#4583d7',
    secondaryColor: '#1b4986',
  },

  /* custom fonts for website */
  /*fonts: {
    myFont: [
      "Times New Roman",
      "Serif"
    ],
    myOtherFont: [
      "-apple-system",
      "system-ui"
    ]
  },*/

  // This copyright info is used in /core/Footer.js and blog rss/atom feeds.
  copyright:
    'Copyright © ' +
    new Date().getFullYear() +
    ' European Commission',

  highlight: {
    // Highlight.js theme to use for syntax highlighting in code blocks
    theme: 'default',
  },

  // Add custom scripts here that would be placed in <script> tags
  scripts: ['https://buttons.github.io/buttons.js'],

  /* On page navigation for the current documentation page */
  onPageNav: 'separate',

  /* Open Graph and Twitter card images */
  ogImage: 'img/docusaurus.png',
  twitterImage: 'img/docusaurus.png',

  // You may provide arbitrary config keys to be used as needed by your
  // template. For example, if you need your repo's URL...
  //   repoUrl: 'https://github.com/facebook/test-site',
};

module.exports = siteConfig;

When I build the website, I do have the "index.html" generated and it works fine.

Thank for your help!

@yansern
Copy link

yansern commented May 17, 2018

I can confirm this is happening to me too. Like @sebelga I am also using Windows 7 64-bit.

Without copying the index.html files from the build folder, accessing http://localhost:3000 will stall for a long time until a timeout occurs.

After performing a fresh installation of docusaurus, I have to:

cd website
yarn build
cp build\test-site\index.html static\index.html
mkdir static\blog
cp build\test-site\blog\index.html static\blog\index.html
yarn start

Then only I can open http://localhost:3000 properly.

UPDATE: I believe this affects Windows platform (as the same is happening on Windows Server 2012). I have tried both NodeJS v8 and NodeJS v10.

@endiliey
Copy link
Contributor

Just adding some data here. With fresh install, I use Windows 10 64-bit through its WSL (Windows Subsystem for Linux) and it works fine. Tried using normal command prompt and it works fine as well. I couldn't reproduce the error.

@JoelMarcey
Copy link
Contributor

@yansern @sebelga @endiliey Not sure you have the means to test this, but if you perform the same steps on a Mac or Linux machine, I assume you don't get the issue?

I just want to pinpoint that this is a Windows-specific problem.

@endiliey
Copy link
Contributor

endiliey commented May 17, 2018

I don't have Mac but just tested it on Ubuntu 16.04.02 LTS with Node v8.10.0 and it worked fine. Latest Docosaurus is being used

@JoelMarcey
Copy link
Contributor

So this looks like a Windows support issue.

There is a PR - #677 - it may not be directly related, but I wonder if it could help.

@endiliey
Copy link
Contributor

It would be very helpful if there is at least a repository in which we can reproduce this bug. If this happens to all windows, then it's obvious that this need to be fixed.

Before all of that, @yansern @sebelga can you try forking Docosaurus and try running it in your local server? Just to pinpoint it's not from old version bug

yarn install
cd website
yarn start

It assume that this only happens on dev server, which is related to Express server routing.

@yansern
Copy link

yansern commented May 22, 2018

Hi @JoelMarcey & @endiliey, I have figured out the issue and it is proxy related.

I'm running behind corporate proxy and I have HTTP_PROXY & HTTPS_PROXY environment variable set. (I wouldn't use Windows 7 unless I had to, I'm a Mac user by heart lol.) I believe @sebelga might be also running behind corporate proxy.

I noticed that under lib/server/server.js, requests ending with / are handled by using the request library to connect explicitly to http://localhost:3000/index.html and send the content back to Express.

What happens is that this request library trying to retrieve http://localhost:3000/index.html through a proxy and therefore unable to resolve to any site and timed out after awhile.

Looking up the docs for request, one can control addresses that shouldn't go through a proxy using the NO_PROXY environment: https://www.npmjs.com/package/request#controlling-proxy-behaviour-using-environment-variables

The solution is just to set localhost to the NO_PROXY environment variable:

SET NO_PROXY = localhost
yarn start

Other tips:

  1. Use comma separator for multiple hostnames, e.g. SET NO_PROXY = localhost,127.0.0.1.
  2. npm also respects NO_PROXY env variable.

@endiliey
Copy link
Contributor

@yansern Thank you for this knowledge & information. Let's see if this work for @sebelga due to him having proxy env set and we might need to consider adding this to documentation. Awesome, i learned something new today.

@sebelga
Copy link
Contributor Author

sebelga commented May 22, 2018

Sorry I haven't replied to previous messages.

@yansern effectively I am behind a corporate proxy with HTTP_PROXY env vars set. 😄

And your fix worked indeed!
But it needs to be set without any spaces

SET NO_PROXY=localhost

Thanks!

@endiliey
Copy link
Contributor

That should be it then. I guess we can close this issue. Horaay 😀. Another thing is @yansern or @sebelga do you want to submit a doc PR for this ? I think that will be helpful. Cc @JoelMarcey

@sebelga
Copy link
Contributor Author

sebelga commented May 22, 2018

Yeah sure I can do it. Should I include it in the "Installation" section? https://docusaurus.io/docs/en/installation.html

@JoelMarcey
Copy link
Contributor

Glad this is resolved. And thanks for #688 😄

yangshun pushed a commit that referenced this issue May 23, 2018
…688)

* Add documentation to launch development server behind a proxy #603

* Update getting-started-installation.md

* Update getting-started-installation.md
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: needs more information There is not enough information to take action on the issue.
Projects
None yet
Development

No branches or pull requests

4 participants