How to set up nginx proxy_pass to follow upstream 302 redirects with multiple redirects
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 2/5
- Tempo stimato
- 1-3 ore
- Idoneità per principianti
- 38/100
- Tipo di issue
- Documentazione
- Chiarezza
- Abbastanza chiara
- Stato di attività
- Ferma
- Stack tecnologico
- nginx
- Ambito
- devops
Direzione di ricerca
Start with the nginx configuration in the issue, especially proxy_set_header, proxy_intercept_errors, recursive_error_pages, error_page, and the @handle_redirect location. Check the repository's existing tip format and placement before documenting this example. Done means the setup is recorded clearly with the multi-redirect behavior and required directives explained.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
The following config shows how to set up nginx proxy to follow upstream 302 redirects.
The upstream server only receive hostname as api.upstream.com, so proxy_set_header directive is necessary.
And the upstream has upstreams recursively, so need to enable recursive_error_pages.
Then the client would get normal 200 response instead of 302 from nginx.
server {
listen 80 myserver.com;
# redirect health status page without Host header:
location /health.status {
proxy_pass http://api.upstream.com;
proxy_redirect http://api.upstream.com/ /;
proxy_intercept_errors on;
recursive_error_pages on;
error_page 301 302 307 = @handle_redirect;
}
location / {
#proxy_pass http://127.0.0.1:8080;
proxy_pass http://api.upstream.com;
## set Host to target server host name
proxy_set_header Host "api.upstream.com";
proxy_redirect http://api.upstream.com/ /;
proxy_intercept_errors on;
recursive_error_pages on;
error_page 301 302 307 = @handle_redirect;
}
location @handle_redirect {
set $original_uri $uri;
set $orig_loc $upstream_http_location;
# nginx goes to fetch the value from the upstream Location header
proxy_pass $orig_loc;
}
}
- Lingua principale
- Python
- Stelle
- 5
- Fork
- 2
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Guida per i contributori
Nessuna guida per i contributori indicizzata per questo repository
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di davideuler/programming-tips
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 35/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 35/100
-
list tags for docker image Aperta
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 35/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 45/100
-
build milvus on Mac Aperta
Difficoltà 3/5 1-2 giorni Idoneità per principianti 35/100
Tutte le issue di davideuler/programming-tips
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 88/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
-
enhancement
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 74/100