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

[Bug] CORS error when using www. subdomain, .css and .js files not loading #375

Closed
4 tasks done
ChadThackray opened this issue Sep 5, 2022 · 4 comments
Closed
4 tasks done
Labels
bug Something isn't working

Comments

@ChadThackray
Copy link

I confirm:

Hugo version

hugo v0.102.0-DEV-7efb35680f4deb82773554be9eb3188d47e6ee0d+extended linux/amd64 BuildDate=2022-08-26T16:50:51Z

Where is this bug showing up?

In the browser: Hugo builds the site, but something doesn't look right.

Operating system

Linux Mint 20.3

Browser (if applicable)

Brave v1.43.89

Current behavior

CORS error when accessing the www.domain.com subdomain.

The error also seems to prevalent on the demo site. If you access www.neonmirrors.net the .css and .js static content won't load. Images seem to be fine.

Expected behavior

The static content should load without any additional configuration by the user in nginx, apache, etc.. I'm using the m10c theme for another website of mine and it loads the static content for both domains with no issues.

Steps to reproduce

See the www. subdomain of the demo site

Relevant log output

No response

Related code

No response

Preferred solution

No response

Other information

No response

@ChadThackray ChadThackray added the bug Something isn't working label Sep 5, 2022
@onweru
Copy link
Collaborator

onweru commented Sep 5, 2022

@ChadThackray, please ensure that in your config.toml file, the baseURL entry has the www., else you will continue to observe the issue(s) you have described 👆🏼

@onweru
Copy link
Collaborator

onweru commented Sep 5, 2022

@ChadThackray, @chipzoller, I think in your server configurations, you ought to configure 301 redirects from the apex domain (no-www) to www, or vice versa. At least it's the standard practice

@ChadThackray
Copy link
Author

Thanks @onweru !

@ChadThackray, please ensure that in your config.toml file, the baseURL entry has the www., else you will continue to observe the issue(s) you have described 👆🏼

I tried this before and got the converse issue, then only www.domain.com worked and not domain.com.

@ChadThackray, @chipzoller, I think in your server configurations, you ought to configure 301 redirects from the apex domain (no-www) to www, or vice versa. At least it's the standard practice

Oh ok, didn't know this was the standard procedure. Still strange that it worked for some other hugo themes but not for this one.

Hopefully this issue will help anyone having the same problem in the future.

@rootwork
Copy link
Contributor

Going to mark this as fixed given the last comment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants