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

Always use https #5

Merged
merged 1 commit into from Apr 23, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/.htaccess
@@ -1 +1,4 @@
RewriteEngine On

RewriteCond %{HTTPS} !=on
Copy link
Contributor

Choose a reason for hiding this comment

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

In the Apache [mod_rewrite spec|https://httpd.apache.org/docs/current/mod/mod_rewrite.html#RewriteCond] it says

The string comparison operator is part of the CondPattern argument and must be included in the quotes if those are used. Eg.

RewriteCond %{HTTP_USER_AGENT} "=This Robot/1.0"

Should the !=on be enclosed in quotes i.e. "!=on"?

Copy link
Member Author

Choose a reason for hiding this comment

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

I don't think so. Numerous places, including apache's own wiki, gives examples without the quotes.

Copy link
Contributor

Choose a reason for hiding this comment

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

Cool. Sounds fine to me then.

RewriteRule ^/?(.*) https://%{SERVER_NAME}/$1 [R,L]
Copy link
Contributor

@ossarga ossarga Apr 23, 2020

Choose a reason for hiding this comment

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

The SERVER_NAME Server-Variable maps to the ServerName Directive. The syntax for this directive says that it can optionally include the scheme. This may cause problems with the rewrite rule if a scheme is included in the server name. Is it worth using the HTTP_HOST instead? The downside I see to this is that HTTP_HOST is the host name only where as the SERVER_NAME can include the port number.

Copy link
Member Author

Choose a reason for hiding this comment

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

have tested it. SERVER_NAME works fine in different scenarios.