Skip to content

Commit

Permalink
Merge pull request #2 from govau/fix_404
Browse files Browse the repository at this point in the history
Fix 404 and allow certificate challenge
  • Loading branch information
gordcorp authored Mar 23, 2018
2 parents 6e2af1d + 0d50bce commit d352683
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 17 deletions.
15 changes: 3 additions & 12 deletions nginx.conf
Original file line number Diff line number Diff line change
Expand Up @@ -58,29 +58,20 @@ http {
# adding some custom rules to strip out the html extension
index index.html;

if (!-f "${request_filename}index.html") {
rewrite ^/(.*)/$ /$1 permanent;
}

if ($request_uri ~* "/index.html") {
rewrite (?i)^(.*)index\.html$ $1 permanent;
}

if ($request_uri ~* ".html") {
rewrite (?i)^(.*)/(.*)\.html $1/$2 permanent;
location /.well-known/pki-validation/338e6e57950543389847dfa7434808b8.txt {
return 200 'd0077b052dce448eadfa0e4e8e19771a';
}

location / {
root <%= ENV["APP_ROOT"] %>/public;

try_files $uri.html $uri $uri/ /index.html;
try_files $uri/index.html $uri.html $uri/ $uri =404;

<% if File.exists?(File.join(ENV["APP_ROOT"], "nginx/conf/.enable_pushstate")) %>
if (!-e $request_filename) {
rewrite ^(.*)$ / break;
}
<% end %>
index index.html index.htm Default.htm;
<% if File.exists?(File.join(ENV["APP_ROOT"], "nginx/conf/.enable_directory_index")) %>
autoindex on;
<% end %>
Expand Down
10 changes: 5 additions & 5 deletions www/404.html
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@
<link rel="shortcut icon" type="image/x-icon" href="favico.ico">
<meta name="csrf-param" content="authenticity_token">
<meta name="csrf-token" content="2B6Cdu3FaYKkvcjpi0RUtuJbyUTRtHfNp7OEb0NajaKpHYB7Hk32FEBvu6wwVji1VFQRrv0pG368Rw3cszejUQ==">
<script src="js/fonts-5cfe6bc8b908837bdc7fec9293f3218caf522af3f672710c8414a04d99165c0a.js" data-turbolinks-track="reload" async="async"></script>
<link rel="stylesheet" media="all" href="css/application-a3be3cb88462fa9da8f5070dff69d461af44aef9098279b1873e41c0b83fa786.css" data-turbolinks-track="reload">
<script src="js/application-a94daa5c647cc7d06c11b44b120c58ec28337733a939f1cd8d4fc7b8419d1ce9.js" data-turbolinks-track="reload" async="async"></script>
<script src="/js/fonts-5cfe6bc8b908837bdc7fec9293f3218caf522af3f672710c8414a04d99165c0a.js" data-turbolinks-track="reload" async="async"></script>
<link rel="stylesheet" media="all" href="/css/application-a3be3cb88462fa9da8f5070dff69d461af44aef9098279b1873e41c0b83fa786.css" data-turbolinks-track="reload">
<script src="/js/application-a94daa5c647cc7d06c11b44b120c58ec28337733a939f1cd8d4fc7b8419d1ce9.js" data-turbolinks-track="reload" async="async"></script>
</head>

<body data-ga-id="UA-81570106-1">
Expand All @@ -60,7 +60,7 @@
<div class="wrapper">
<div class="home-header-content">
<a class="govau--logo home" href="/">
<img alt="GOV.AU crest logo" src="img/gov-au-white-2x-49a1845dae751560e8590a6cb8c073771a374f3dc9a35c1bd5f2028f08194446.png">
<img alt="GOV.AU crest logo" src="/img/gov-au-white-2x-49a1845dae751560e8590a6cb8c073771a374f3dc9a35c1bd5f2028f08194446.png">
</a>
<div class="homeintro">
<h1 class="is-visuallyhidden">
Expand Down Expand Up @@ -104,7 +104,7 @@ <h1>Sorry, we can’t find the page you’re looking&nbsp;for</h1>
<div class="wrapper">
<section>
<div class="footer-logo">
<img alt="Australian Government Coat of Arms" src="img/coat-of-arms-af51ab555b0040c7bcda43484858d96594d2cb60d71ff58ff91003a9cc7f3e81.png">
<img alt="Australian Government Coat of Arms" src="/img/coat-of-arms-af51ab555b0040c7bcda43484858d96594d2cb60d71ff58ff91003a9cc7f3e81.png">
</div>
<div class="footer-links">
<nav>
Expand Down

0 comments on commit d352683

Please sign in to comment.