Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
H
heroku-buildpack-static
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
JIRA
JIRA
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Python-Dev
heroku-buildpack-static
Commits
d03c2716
Commit
d03c2716
authored
Mar 16, 2017
by
Terence Lee
Committed by
GitHub
Mar 16, 2017
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #62 from heroku/clean_urls_conflict
Fix #57. Clean URLs clean even if there's a directory
parents
fb0a4954
df1001f2
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
31 additions
and
3 deletions
+31
-3
nginx.conf.erb
scripts/config/templates/nginx.conf.erb
+2
-2
foo.html
spec/fixtures/clean_urls_conflict/public_html/foo.html
+1
-0
bar.html
spec/fixtures/clean_urls_conflict/public_html/foo/bar.html
+1
-0
static.json
spec/fixtures/clean_urls_conflict/static.json
+3
-0
foo.html
spec/fixtures/ordering_clean_urls/public_html/foo.html
+1
-0
bar.html
spec/fixtures/ordering_clean_urls/public_html/foo/bar.html
+1
-0
simple_spec.rb
spec/simple_spec.rb
+22
-1
No files found.
scripts/config/templates/nginx.conf.erb
View file @
d03c2716
...
@@ -46,7 +46,7 @@ http {
...
@@ -46,7 +46,7 @@ http {
mruby_post_read_handler /app/bin/config/lib/ngx_mruby/headers.rb cache;
mruby_post_read_handler /app/bin/config/lib/ngx_mruby/headers.rb cache;
mruby_set $fallback /app/bin/config/lib/ngx_mruby/routes_fallback.rb cache;
mruby_set $fallback /app/bin/config/lib/ngx_mruby/routes_fallback.rb cache;
<%
if
clean_urls
%>
<%
if
clean_urls
%>
try_files $uri
$uri/ $uri.html
$fallback;
try_files $uri
.html $uri $uri/
$fallback;
<%
else
%>
<%
else
%>
try_files $uri $uri/ $fallback;
try_files $uri $uri/ $fallback;
<%
end
%>
<%
end
%>
...
@@ -70,7 +70,7 @@ http {
...
@@ -70,7 +70,7 @@ http {
mruby_set $path /app/bin/config/lib/ngx_mruby/routes_path.rb cache;
mruby_set $path /app/bin/config/lib/ngx_mruby/routes_path.rb cache;
mruby_set $fallback /app/bin/config/lib/ngx_mruby/routes_fallback.rb cache;
mruby_set $fallback /app/bin/config/lib/ngx_mruby/routes_fallback.rb cache;
<%
if
clean_urls
%>
<%
if
clean_urls
%>
try_files $uri
$uri/ /$uri.html
$path $fallback;
try_files $uri
.html $uri $uri/
$path $fallback;
<%
else
%>
<%
else
%>
try_files $uri $path $fallback;
try_files $uri $path $fallback;
<%
end
%>
<%
end
%>
...
...
spec/fixtures/clean_urls_conflict/public_html/foo.html
0 → 100644
View file @
d03c2716
foobar
spec/fixtures/clean_urls_conflict/public_html/foo/bar.html
0 → 100644
View file @
d03c2716
bar
spec/fixtures/clean_urls_conflict/static.json
0 → 100644
View file @
d03c2716
{
"clean_urls"
:
true
}
spec/fixtures/ordering_clean_urls/public_html/foo.html
0 → 100644
View file @
d03c2716
foo
spec/fixtures/ordering_clean_urls/public_html/foo/bar.html
0 → 100644
View file @
d03c2716
foobar
spec/simple_spec.rb
View file @
d03c2716
...
@@ -68,6 +68,23 @@ RSpec.describe "Simple" do
...
@@ -68,6 +68,23 @@ RSpec.describe "Simple" do
expect
(
response
.
body
.
chomp
).
to
eq
(
"bar"
)
expect
(
response
.
body
.
chomp
).
to
eq
(
"bar"
)
end
end
end
end
context
"when there is a conflict"
do
let
(
:name
)
{
"clean_urls_conflict"
}
it
"should be able to handle when a directory and .html file share the same name"
do
app
.
run
do
response
=
app
.
get
(
"/foo/bar"
)
expect
(
response
.
code
).
to
eq
(
"200"
)
expect
(
response
.
body
.
chomp
).
to
eq
(
"bar"
)
response
=
app
.
get
(
"/foo"
)
expect
(
response
.
code
).
to
eq
(
"200"
)
expect
(
response
.
body
.
chomp
).
to
eq
(
"foobar"
)
end
end
end
end
end
describe
"routes"
do
describe
"routes"
do
...
@@ -548,9 +565,13 @@ STATIC_JSON
...
@@ -548,9 +565,13 @@ STATIC_JSON
expect
(
response
.
code
).
to
eq
(
"302"
)
expect
(
response
.
code
).
to
eq
(
"302"
)
expect
(
app
.
get
(
response
[
"location"
]).
body
.
chomp
).
to
eq
(
"goodbye"
)
expect
(
app
.
get
(
response
[
"location"
]).
body
.
chomp
).
to
eq
(
"goodbye"
)
response
=
app
.
get
(
"/
fo
o"
)
response
=
app
.
get
(
"/
hell
o"
)
expect
(
response
.
code
).
to
eq
(
"200"
)
expect
(
response
.
code
).
to
eq
(
"200"
)
expect
(
response
.
body
.
chomp
).
to
eq
(
"hello world"
)
expect
(
response
.
body
.
chomp
).
to
eq
(
"hello world"
)
response
=
app
.
get
(
"/foo"
)
expect
(
response
.
code
).
to
eq
(
"200"
)
expect
(
response
.
body
.
chomp
).
to
eq
(
"foo"
)
end
end
end
end
end
end
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment