Closed ryanmerolle closed 2 years ago
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
Is there anything I can provide to help here?
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
Well I found https://snipe-it.readme.io/docs/configuration#optional-set-your-htaccess-to-redirect-to-ssl
IE you need to mount /var/www/html/public/.htaccess with the following config:
<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
Options -MultiViews
</IfModule>
RewriteEngine On
# Uncomment these two lines to force SSL redirect in Apache
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
# Redirect Trailing Slashes If Not A Folder...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} (.+)/$
RewriteRule ^ %1 [L,R=301]
# Handle Front Controller...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
# Handle Authorization Header
RewriteCond %{HTTP:Authorization} .
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
# Security Headers
# Header set Strict-Transport-Security "max-age=2592000" env=HTTPS
# Header set X-XSS-Protection "1; mode=block"
# Header set X-Content-Type-Options nosniff
# Header set X-Permitted-Cross-Domain-Policies "master-only"
</IfModule>
Options -Indexes
Interestingly enough I still cannot get http to redirect to https. I will update here as I troubleshoot.
I cannot believe I missed the base vm referenced to nginx. You have to update the nginx config blob/master/root/defaults/default and mount the volume. The confusion as around the fact that snipe-it documentation uses/references apache.
This could easily be tweaked in the image with an env variable also added.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
This can be configured in /config/nginx/site-confs/default:
IE:
server {
listen 80 default_server;
return 301 https://localhost:8080;
}
server {
listen 443 ssl;
server_name localhost:8080;
root /var/www/html/public;
index index.html index.htm index.php;
ssl_certificate /config/keys/cert.crt;
ssl_certificate_key /config/keys/cert.key;
client_max_body_size 0;
location / {
try_files $uri $uri/ /index.php$is_args$args;
}
location ~ \.php$ {
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
include /etc/nginx/fastcgi_params;
}
location /.env {
return 404;
}
}
Desired Behavior
Environment variable for if https is enabled, then setup http to redirect.
Current Behavior
With key/cert in place & both HTTP/HTTPS ports set with docker, both services respond. HTTP does not redirect to HTTPS
Alternatives Considered