GitHub Codespaces 502 Gateway Error Serving a docfx site

1.1k Views Asked by At

I am working to add GitHub Codespaces to the NUnit docs repository for document editing. We're really excited about the potential of Codespaces for our use case!

The Current Ingredients

Reproduction

  • Open the codespace
  • Open the terminal
  • cd docs
  • docfx build - builds successfully, as expected
  • docfx serve - indicates it is serving on port 8080, as expected
  • Follow the link from the terminal, which opens the port 8080 in a forwarded tab

Expected Behavior

See the site at the root site at the /_site subdirectory which is where docfx serves items

Actual Behavior

See a 502 bad gateway error at the initial URL, and also when attempting with /_site appended.

Other Things I've tried

  • I've pulled this branch in VS Code on my machine and opened it in this container. I was able to see the site served as expected on both the forwarded 8080 port root and with /_site appended.
1

There are 1 best solutions below

0
On BEST ANSWER

I figured it out! Thanks to this comment: https://github.com/dotnet/docfx/issues/3615#issuecomment-451664865

In this case, because docfx is using WebApp.Start(), the correct syntax inside of the container is:

docfx serve _site -n "*"

That "*" is what makes the difference here and allows mono to bind appropriately for the forwarding to work.