Answer the question
In order to leave comments, you need to log in
Why is the request not being proxied?
Hello.
An application is raised in the docker, at the entrance of which is nginx with the following config:
server {
listen 80;
server_name my.localhost;
location ^/cdn/ {
proxy_pass http://app:8082/;
}
location ^/api/ {
proxy_pass http://app:8081/;
}
location / {
proxy_pass http://app:8080;
}
}
server {
listen 80;
server_name cdn.localhost;
location / {
proxy_pass http://app:8082;
}
}
server {
listen 80;
server_name internal-api.localhost;
location / {
proxy_pass http://app:8081;
}
}
<VirtualHost *:8080>
ServerName 127.0.0.1
DocumentRoot "/app/frontend/web/"
<Directory "/app/frontend/web/">
DirectoryIndex index.html
Require all granted
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.html [L]
</Directory>
LogLevel debug
</VirtualHost>
<VirtualHost *:8081>
ServerName 127.0.0.1
DocumentRoot "/app/api/web/"
<Directory "/app/api/web/">
# use mod_rewrite for pretty URL support
RewriteEngine on
# If a directory or a file exists, use the request directly
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
# Otherwise forward the request to index.php
RewriteRule . index.php
# use index.php as index file
DirectoryIndex index.php
# ...other settings...
# Apache 2.4
Require all granted
## Apache 2.2
# Order allow,deny
# Allow from all
</Directory>
</VirtualHost>
<VirtualHost *:8082>
ServerName 127.0.0.1
DocumentRoot "/app/static/web/"
<Directory "/app/static/web/">
# use mod_rewrite for pretty URL support
RewriteEngine on
# If a directory or a file exists, use the request directly
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
# Otherwise forward the request to index.php
RewriteRule . index.php
# use index.php as index file
DirectoryIndex index.php
# ...other settings...
# Apache 2.4
Require all granted
## Apache 2.2
# Order allow,deny
# Allow from all
</Directory>
</VirtualHost>
app_1 | [Thu Feb 25 08:39:46.175271 2021] [authz_core:debug] [pid 16] mod_authz_core.c(820): [client 172.27.0.5:54222] AH01626: authorization result of Require all granted: granted
app_1 | [Thu Feb 25 08:39:46.175332 2021] [authz_core:debug] [pid 16] mod_authz_core.c(820): [client 172.27.0.5:54222] AH01626: authorization result of <RequireAny>: granted
app_1 | [Thu Feb 25 08:39:46.176128 2021] [core:error] [pid 16] [client 172.27.0.5:54222] AH00124: Request exceeded the limit of 10 internal redirects due to probable configuration error. Use 'LimitInternalRecursion' to increase the limit if necessary. Use 'LogLevel debug' to get a backtrace.
app_1 | [Thu Feb 25 08:39:46.176153 2021] [core:debug] [pid 16] core.c(3833): [client 172.27.0.5:54222] AH00121: r->uri = /index.html
app_1 | [Thu Feb 25 08:39:46.176159 2021] [core:debug] [pid 16] core.c(3840): [client 172.27.0.5:54222] AH00122: redirected from r->uri = /index.html
app_1 | [Thu Feb 25 08:39:46.176164 2021] [core:debug] [pid 16] core.c(3840): [client 172.27.0.5:54222] AH00122: redirected from r->uri = /index.html
app_1 | [Thu Feb 25 08:39:46.176170 2021] [core:debug] [pid 16] core.c(3840): [client 172.27.0.5:54222] AH00122: redirected from r->uri = /index.html
app_1 | [Thu Feb 25 08:39:46.176176 2021] [core:debug] [pid 16] core.c(3840): [client 172.27.0.5:54222] AH00122: redirected from r->uri = /index.html
app_1 | [Thu Feb 25 08:39:46.176183 2021] [core:debug] [pid 16] core.c(3840): [client 172.27.0.5:54222] AH00122: redirected from r->uri = /index.html
app_1 | [Thu Feb 25 08:39:46.176187 2021] [core:debug] [pid 16] core.c(3840): [client 172.27.0.5:54222] AH00122: redirected from r->uri = /index.html
app_1 | [Thu Feb 25 08:39:46.176193 2021] [core:debug] [pid 16] core.c(3840): [client 172.27.0.5:54222] AH00122: redirected from r->uri = /index.html
app_1 | [Thu Feb 25 08:39:46.176199 2021] [core:debug] [pid 16] core.c(3840): [client 172.27.0.5:54222] AH00122: redirected from r->uri = /index.html
app_1 | [Thu Feb 25 08:39:46.176205 2021] [core:debug] [pid 16] core.c(3840): [client 172.27.0.5:54222] AH00122: redirected from r->uri = /index.html
app_1 | [Thu Feb 25 08:39:46.176212 2021] [core:debug] [pid 16] core.c(3840): [client 172.27.0.5:54222] AH00122: redirected from r->uri = /api/
Answer the question
In order to leave comments, you need to log in
location ^/api/ {
proxy_pass http://app:8081/;
}
location / {
proxy_pass http://app:8080;
}
~
location ~ ^/api/ {
location /api/ {
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question