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

SSL on reverse proxy code example update #169

Open
ethanclevenger91 opened this issue Oct 21, 2022 · 4 comments
Open

SSL on reverse proxy code example update #169

ethanclevenger91 opened this issue Oct 21, 2022 · 4 comments
Assignees
Labels
documentation Improvements or additions to documentation enhancement New feature or request good first issue Good for newcomers

Comments

@ethanclevenger91
Copy link

Issue Description

The code example currently on this page will throw PHP notices when running WP-CLI commands, potentially in other situations in which wp-config.php is loaded outside the context of a normal web request, or when the request is missing expected headers.

URL of the Page with the Issue

https://wordpress.org/support/article/administration-over-ssl/

Section of Page with the issue

The Reverse Proxy example

Why is this a problem?

PHP notices are noisy.

Suggested Fix

if (strpos($_SERVER['HTTP_X_FORWARDED_PROTO'], 'https') !== false)
$_SERVER['HTTPS']='on';

Should become...

if (isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && strpos($_SERVER['HTTP_X_FORWARDED_PROTO'], 'https') !== false)
$_SERVER['HTTPS']='on';

Personally, I'd also add curly braces, but I would ultimately defer that decision to core's code style guide. Not sure what the policy is without looking.

@stevenlinx stevenlinx self-assigned this Oct 22, 2022
@github-actions
Copy link

Heads up @lucprincen @javiercasares - the "advanced administration" label was applied to this issue.

@stevenlinx
Copy link
Member

Thank you for filing.

Yes, according to the coding standard, you do need curly braces for control structures.
https://developer.wordpress.org/coding-standards/wordpress-coding-standards/php/#brace-style

I've made the revision.

@javiercasares javiercasares transferred this issue from WordPress/Documentation-Issue-Tracker Jan 31, 2023
@javiercasares javiercasares reopened this Jan 31, 2023
@javiercasares
Copy link
Collaborator

File: security/https.md

The code needs to be reviewed to check the set of the variable before using it

To-Do

  • Fix the code

@javiercasares javiercasares added documentation Improvements or additions to documentation enhancement New feature or request good first issue Good for newcomers labels Jan 31, 2023
@stevenlinx
Copy link
Member

@javiercasares

You need to open a new Issue over at Advanced administration handbook regrading migration of content, rather than re-opening this Issue.

The two tasks runs in parallel:

  • to fix error on the existing content
  • to migrate relevant content from HelpHub to DevHub (Advanced administration handbook).

You're dragging OP into something that's not relevant to him.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation enhancement New feature or request good first issue Good for newcomers
Projects
Status: 🏗 In progress
Development

No branches or pull requests

3 participants