nginx匹配位置并返回失败

时间:2019-10-31 22:12:18

标签: nginx nginx-location

以下代码片段效果很好。

class Seeds extends Component{
  constructor (props) {
    super(props);
    this.state = { 
        formSeeds: {
          arabica:'',
          hybrid:'',
          robusta:'',
          my_bean:'',
        },
        redirect: false
    };

handleSubmitMyBean(event) {
    event.preventDefault();
    //const formType = this.props.formType
    const {userId} = this.props
    var headers = {
          'Content-Type': 'application/json',
          Authorization: `Bearer ${window.localStorage.authToken}`
        }
    const data = {
      my_bean: this.state.formSeeds.my_bean
    };

    const url = `${process.env.REACT_APP_WEB_SERVICE_URL}/handle_seeds/${userId}`;

    axios.post(url, data, headers)
      .then((res) => {
        //this.clearSeedsForm()
        console.log(data);
      })
      .catch((error) => { console.log(error); 
    });
  };

  handleSeedFormChange(event) {
    console.log(event)
    const obj = Object.assign({}, this.state.formSeeds);
    obj[event.target.name] = event.target.value;
    this.setState({ formSeeds: obj });
    this.validateForm();
  };

render(){
      <div>
      if(this.state.formSeeds.my_bean){
        return (<Redirect to='/edit-coffee' />);
      }

      <form onSubmit={ (event) => this.handleSubmitMyBean(event) }>
                <div className="field">
                 <input
                  name="my_bean"
                  className="input is-dark is-large"
                  type="text"
                  placeholder="Enter Bean"
                  value={this.state.formSeeds.my_bean}
                  onChange={this.handleMyBeanFormChange}
                  />
                </div>
                <input
                  type="submit"
                  className="button is-dark is-small is-fullwidth"
                  value="Seed Bean"
                  //disabled={!this.state.valid}  
                />
            </form>
           </div>
        )
       }

我可以成功卷曲server { listen 0.0.0.0:80; server_name foo.com; location /.well-known/acme-challenge { alias /var/www/html; } } 中的文件。 现在,我想为与位置不匹配的请求添加fallthrough处理。

/var/www/html

但是现在所有请求返回301。 如果位置匹配,请求处理是否应该停止?

0 个答案:

没有答案