nginx reverse proxy regular expression configuration problem
伊谢尔伦
伊谢尔伦 2017-05-16 17:23:02
0
1
533

My nginx reverse proxy configuration is as follows:

location ^~ /a(pi|uth) {
    proxy_pass http://localhost:3000;

    # Proxy Settings
    proxy_set_header    HOST    $host;
    proxy_set_header    X-Real-IP   $remote_addr;
    proxy_set_header    X-Forwarded-For     $proxy_add_x_forwarded_for;
    ...
}

Hope that requests from /api/* and /auth/* are sent to port 3000, but it seems that the matching is not successful. I think there should be no problem with regular expressions

javascript/a(pi|uth)/.test('api') // true

I directly location ^~ /api can be matched, but it doesn’t work if I use regular expressions. I don’t know what’s going on

伊谢尔伦
伊谢尔伦

小伙看你根骨奇佳,潜力无限,来学PHP伐。

reply all(1)
PHPzhong
location ~* /a(pi|uth)

After looking at it, it seems that ^~does not match the regular expression

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template