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

hugo server output misleading & Cross-Origin Resource Sharing policy #1426

Closed
txgo opened this issue Sep 13, 2015 · 3 comments
Closed

hugo server output misleading & Cross-Origin Resource Sharing policy #1426

txgo opened this issue Sep 13, 2015 · 3 comments
Labels
Milestone

Comments

@txgo
Copy link

txgo commented Sep 13, 2015

when run hugo server command it output:

...
Web server is available at http://127.0.0.1:1313
...

If using http://127.0.0.1:1313 to visit local server using Chorme and local font files, we may get this error:

Font from origin 'http://localhost:1313' has been blocked from loading by Cross-Origin Resource Sharing policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://127.0.0.1:1313' is therefore not allowed access.

Actually the quickstart document is right, we should visit "http://localhost:1313", the hugo server cmd output is misleading.

@anthonyfok
Copy link
Member

Hi @txgo, thank you for reporting this issue.

I did a little bit of digging, and it turns out the hugo server output changed only a few months ago:

  • Hugo v0.13 (Feb 2015): Web Server is available at http://localhost:1313/
  • Hugo v0.14 (May 2015): Web Server is available at http://127.0.0.1:1313/

The change first happened at commit 2bfa9fb (Fri May 1 22:28:21 2015 -0400):

Make server bind interface configurable.

Bind by default to 127.0.0.1. Previously it always bound to all interfaces.

Always have log message display that the server is available on the
interface to which it is bound, instead of the baseUrl.

Fixes #1097

#1097 deals with "Web server listens on all interfaces and says it's on localhost", and it was fixed with push request #1099.

How about we try to make the best of both worlds by making Hugo v0.15 display the following instead?

Web Server is available at http://localhost:1313/ (bind address 127.0.0.1)

@anthonyfok anthonyfok added this to the v0.15 milestone Sep 16, 2015
@anthonyfok
Copy link
Member

I went ahead and pushed a patch which changes the hugo server to the following:

Web Server is available at http://localhost:1313/ (bind address 127.0.0.1)

and see how people like it. Will update the documentation accordingly at release time if everyone (or most people) are happy with the change. 😉

@github-actions
Copy link

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 13, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants