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

chore(nginx): updated nodejs.org configuration #3139

Merged
merged 4 commits into from Mar 15, 2023
Merged

Conversation

ovflowd
Copy link
Member

@ovflowd ovflowd commented Dec 31, 2022

This PR introduces several Nginx changes that simplify the current configuration and fix current bugs.

Configuration changes

  • Merge HTTP and HTTPS server blocks for redirects
  • Removes non-needed configuration from the default nodejs.org:80 server block
  • Removes the nodejs.org:80 redirect to nodejs.org:443 server block in favor of a return 301 rule
  • Removes legacy rules such as (/blog redirecting to blog.nodejs.org), which could cause a "too many redirects" error
  • Fixes the blog.nodejs.org:80 configuration which caused "too many redirects" and was broken
  • Removed broken server rules such as the newsletter.nodejs.org
  • Fixed broken foundation.nodejs.org location rules to the respective links of openjsf.org:443
  • Reorganised the file (first both 80/443 ports for nodejs.org then all the extras)
  • Added @todo's for the upcoming Next.js rewrite of nodejs.org

@ovflowd
Copy link
Member Author

ovflowd commented Dec 31, 2022

cc @nodejs/build @Trott @bnb @joesepi

@ovflowd
Copy link
Member Author

ovflowd commented Jan 3, 2023

cc @richardlau

@ovflowd
Copy link
Member Author

ovflowd commented Jan 4, 2023

@UlisesGascon could you also give an eye here 👀

@richardlau
Copy link
Member

I've deployed this onto the server. I'm not feeling too well this week, so if anything looks wrong with these changes I'm likely to just back them out rather than try to troubleshoot.

@richardlau richardlau merged commit 92c5c08 into nodejs:main Mar 15, 2023
@nschonni
Copy link
Member

This appears to now redirecting http://unencrypted.nodejs.org/ traffic to HTTPS, where it's supposed to be a breakout for that traffic

default_type text/plain;
}

location /.well-known/security.txt {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This no longer works/is being served

Copy link
Member Author

@ovflowd ovflowd Mar 15, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This file doesn't really exist. This rewrite can probably be deleted as this file is not being served anymore.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It did in that location before, and is now located https://github.com/nodejs/nodejs.org/blob/main/public/security.txt

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, I think you're confusing things. There was never a well-known/security.txt (https://github.com/nodejs/nodejs.org/tree/fb666ed663e4d0511beced38cf9505a688bde898/static) (ref before next migration).

Or are you trying to say that /.well-known/security.txt should redirect to /security.txt?

Copy link
Member Author

@ovflowd ovflowd Mar 15, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, I see what you're talking about. Let me make a PR.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This redirect was serving the file in static/security.txt through the .well-known address, which is per it's spec https://securitytxt.org/

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This redirect was serving the file in static/security.txt through the .well-known address, which is per it's spec securitytxt.org

Aware of that spec, my bad, I just switched these two 👀

@ovflowd
Copy link
Member Author

ovflowd commented Mar 15, 2023

I don't see any configuration for unecrypted.nodejs.org. (Whatever that was, it was not changed)

@nschonni
Copy link
Member

There wasn't a specific config, but there wasn't a global HTTP to HTTPS rewrite rule before, which supported that old endpoint

@ovflowd
Copy link
Member Author

ovflowd commented Mar 15, 2023

Is there any reason we should support unencrypted.nodejs.org?

There wasn't a global rewrite, yes, but pretty much all the "meaningful" routes were being redirected to https. Which made sense to do a global redirect.

@nschonni
Copy link
Member

It is there to support clients like NVM that need it for old platforms I believe, but maybe @ljharb can confirm.
It shouldn't be broken/dropped without a discussion with the TSC though

@ovflowd ovflowd deleted the patch-1 branch March 15, 2023 22:53
@ovflowd
Copy link
Member Author

ovflowd commented Mar 15, 2023

It is there to support clients like NVM that need it for old platforms I believe, but maybe @ljharb can confirm.
It shouldn't be broken/dropped without a discussion with the TSC though

Then it is working fine. Because it will not redirect for the /dist stuff :)

@nschonni
Copy link
Member

No, it is breaking the dist

C:\Users\nick_>curl http://unencrypted.nodejs.org/dist/v0.1.27/SHASUMS256.txt
<html>
<head><title>404 Not Found</title></head>
<body bgcolor="white">
<center><h1>404 Not Found</h1></center>
<hr><center>nginx/1.10.3 (Ubuntu)</center>
</body>
</html>

C:\Users\nick_>curl https://unencrypted.nodejs.org/dist/v0.1.27/SHASUMS256.txt
1f83401b9ede7558350e183fc4386234a803d1253e7fe99bce0aba7138270806  node-v0.1.27.tar.gz

@ovflowd
Copy link
Member Author

ovflowd commented Mar 15, 2023

@nschonni that's not how the unencrypted.nodejs.org apparentlya works. This is a valid URL curl -v http://unencrypted.nodejs.org/download/release/node-v0.6.5.tar.gz

If you curl -v http://unencrypted.nodejs.org, it gives you an HTML welcome page, and then I navigated over it. This URL seems to be served somewhere else, as the IP address is neither CloudFlare nor the server where nodejs.org is residing 🤔

@ovflowd
Copy link
Member Author

ovflowd commented Mar 15, 2023

Also curl -v http://unencrypted.nodejs.org/download/release/v19.8.1/ seems to be what would be curl -v https://nodejs.org/dist/v19.8.1/. Does this answer your questions?

@BethGriggs
Copy link
Member

It shouldn't be broken/dropped without a discussion with the TSC though

There was some discussion in #2857 about unencrypted.nodejs.org, where we enabled HSTS.

@ljharb
Copy link
Member

ljharb commented Mar 16, 2023

unless http traffic redirects to unencrypted, nvm doesn’t use it.

That said, it still seems important to preserve an http escape hatch.

@richardlau
Copy link
Member

For a long time http://unencrypted.nodejs.org's landing page had a warning that it was to be sunset on 1 January 2022 (last year). #2857 (comment). My opinion is that it's not worth spending time resurrecting it.

@ovflowd
Copy link
Member Author

ovflowd commented Mar 16, 2023

If it was supposed to be sunset them we should sunset it 🤔

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants