nginx... why do I need the additional location block? -


i wondering if clarify why adding did able fix problem although problem fixed, i'm not sure why works , wasn't working in setup before.

the old setup:

i have files served @ following address: http://192.168.33.1:3000/bower_components/... e.g., (http://192.168.33.1:3000/bower_components/animate.css/animate.css)

i have nginx reverse proxy set @ http://192.168.33.10:80/

i have following location block:

location /content {    proxy_pass http://192.168.33.1:3000/;    proxy_redirect off;    proxy_set_header host $host;    proxy_set_header x-real-ip $remote_addr;    proxy_set_header x-forwarded-for $proxy_add_x_forwarded_for;    proxy_max_temp_file_size 0;    client_max_body_size 10m;    client_body_buffer_size 128k;    proxy_connect_timeout 90;    proxy_send_timeout 90;    proxy_read_timeout 90;    proxy_buffer_size 4k;    proxy_buffers 4 32k;    proxy_busy_buffers_size 64k;    proxy_temp_file_write_size 64k; } 

in setup, following url load: http://192.168.33.10/content/app/index.css

but following url give me 404, though accessing file directly load fine: http://192.168.33.10/content/bower_components/animate.css/animate.css (or else in bower_components folder matter)

the fix:

after playing around bit found if added following location block, things work:

location /content/bower_components {      proxy_pass http://192.168.33.1:3000/bower_components; } 

i understand why additional location block work don't understand why original location block did not encompass rule of addition location block added.

any advise what's going on?

this may or may not correct answer, but...

the location block:

location /content {     proxy_pass http://192.168.33.1:3000/;     ... } 

is aliasing uris beginning /content /, missing terminating /.

i use:

location /content/ {     proxy_pass http://192.168.33.1:3000/;     ... } 

and fix specific case of /content if need to.

i don't know why http://192.168.33.10/content/app/index.css seems work though.

see this document details.


Comments

Popular posts from this blog

jOOQ update returning clause with Oracle -

java - Warning equals/hashCode on @Data annotation lombok with inheritance -

java - BasicPathUsageException: Cannot join to attribute of basic type -