-
Notifications
You must be signed in to change notification settings - Fork 427
Feature Request: Wildcards in Redirects #92
Comments
I think this doesn't work currently because the config generator uses named locations. I think this can be fixed with: jamesward@f0c5550 |
With the change above my
|
@jamesward Wouldn't this be a breaking change for existing users though? Especially since most of us already use the git url for the buildpack. I mention this because I'd love to have wildcard support as well but noticed my named redirects getting borked. May be add a new section just for wildcard redirects? |
@sivakumar-kailasam Yeah, that is a good point. Probably need some tests to validate non-breakage. |
We took a very slightly different approach to this. We also stopped using named locations for redirects because it was impossible for us to set a redirect for You can see the code here: https://github.com/stonecircle/heroku-buildpack-ember-static/blob/master/scripts/config/templates/nginx.conf.erb#L108 but essentially we allow users to set "force_redirect" to be true and then it will define redirects using regex. Another way to approach this would be to have each rule define if it wanted to use the regex approach. What are people's thoughts? |
I have extracted the basis for my previous implementation into a PR that captures a more useful API for this functionality: #105 Please let me know if anyone finds this useful 👍 |
> Fixes heroku#92 > > I have implemented an example repo that is using this fork of the buildpack and it is working exactly as expected. > > You can see a (silly) index page that explains what is going on here: static-test-mansona.herokuapp.com > > Essentially what it allows you to do is to define indvidual rules as regex as you see fit, this way you can make full use of wildcards and domain redirects. Here is an example config: > > ``` > { > "root": "public_html", > "clean_urls": true, > "redirects": { > "/standard/": { > "url": "https://heroku.com", > "status": 302 > }, > "/magic(.*)": { > "url": "https://stonecircle.io$1", > "regex": true > } > } > } > ``` > > As you can see that if you visit static-test-mansona.herokuapp.com/magic/opensource it will redirect you to stonecircle.io/opensource 👍 -- @mansona See https://github.com/heroku/heroku-buildpack-static/pull/105/files
Why isn't this merged? Seems like a really good feature. |
Hi This buildpack is now deprecated and we are recommending people move the more actively maintained heroku-buildpack-nginx. For migration advice see here. As such, I'm closing this issue out since we won't be making further changes to this buildpack. |
Support wildcards in redirects, like:
So that
/foo/bar/baz
will redirect to/bar/baz
and/foo/asdf
will redirect to/asdf
.The text was updated successfully, but these errors were encountered: