{"id":9440,"date":"2025-10-28T18:08:31","date_gmt":"2025-10-28T12:38:31","guid":{"rendered":"https:\/\/pheonixsolutions.com\/blog\/?p=9440"},"modified":"2026-08-25T09:23:27","modified_gmt":"2026-08-25T03:53:27","slug":"fixing-http-307-redirect-issue-in-reverse-proxy-setup","status":"publish","type":"post","link":"https:\/\/pheonixsolutions.com\/blog\/fixing-http-307-redirect-issue-in-reverse-proxy-setup\/","title":{"rendered":"Fixing HTTP 307 Redirect Issue in Reverse Proxy Setup"},"content":{"rendered":"\n<h3 class=\"wp-block-heading\"><strong>1. Introduction<\/strong><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">When setting up a reverse proxy (for example, using Nginx) in front of a backend service like Argo CD or any HTTPS-only application, you might encounter the error:<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">HTTP\/1.1 307 Temporary Redirect\nLocation: https:\/\/&lt;backend-ip&gt;:&lt;port&gt;\/\n<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">This happens when the proxy forwards <strong>HTTP traffic<\/strong> to a <strong>backend that enforces HTTPS<\/strong>.<br>As a result, the backend keeps redirecting the request back to HTTPS, creating a continuous redirect loop.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>2. Prerequisites<\/strong><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Before starting, make sure:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>You have SSH or console access to your web server.<\/li>\n\n\n\n<li>Ports <strong>80<\/strong> and <strong>443<\/strong> are open and accessible.<\/li>\n\n\n\n<li>The backend service (e.g., Argo CD) is running and reachable from the proxy server.<\/li>\n\n\n\n<li>You can test connectivity using: <br>$ <code>curl -IL http:\/\/&lt;backend-ip&gt;:&lt;port&gt; # should show 307 redirect <\/code><br><code>$ curl -kIL https:\/\/&lt;backend-ip&gt;:&lt;port&gt;\/ # should return 200 OK<\/code><\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>3. Steps to Resolve<\/strong><\/h3>\n\n\n\n<ol class=\"wp-block-list\">\n<li><strong>Identify the cause<\/strong><br>The proxy (Nginx) was using <code>http:\/\/<\/code> to communicate with a backend that only supports <code>https:\/\/<\/code>.<br>This mismatch triggers the 307 redirect.<\/li>\n\n\n\n<li><strong>Update the proxy configuration<\/strong><ul><li>Change the proxy URL from <code>http:\/\/&lt;backend-ip&gt;:&lt;port&gt;<\/code> \u2192 <code>https:\/\/&lt;backend-ip&gt;:&lt;port&gt;<\/code>.Ensure <code>proxy_ssl_verify off;<\/code> if the backend uses a self-signed certificate.                  Add forwarded headers such as:                                                                                                    <code>X-Forwarded-Proto: https                                                               X-Forwarded-For: $proxy_add_x_forwarded_for<\/code><\/li><\/ul>These tell the backend that the original client is already using HTTPS.<\/li>\n\n\n\n<li><strong>Reload the proxy service<\/strong> <br>$ <code>sudo nginx -t &amp;&amp; sudo systemctl reload nginx<\/code><\/li>\n\n\n\n<li><strong>Verify the fix<\/strong> <br>$ <code>curl -IL http:\/\/yourdomain.com # should return 301 \u2192 https <\/code><br>$ <code>curl -IL https:\/\/yourdomain.com # should return 200 OK<\/code> <br>The site should now open normally without looping redirects.<\/li>\n<\/ol>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>4. Conclusion<\/strong><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">The <strong>HTTP 307 Temporary Redirect<\/strong> is not an error\u2014it\u2019s a signal that the backend accepts only HTTPS connections.<br>The issue occurs when your proxy tries to communicate with the backend over plain HTTP.<br>By updating the proxy to use <strong>HTTPS<\/strong> for backend connections and aligning the protocols, the loop is resolved, and secure communication is established end-to-end.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>1. Introduction When setting up a reverse proxy (for example, using Nginx) in front of a backend service like Argo [&hellip;]<\/p>\n","protected":false},"author":508,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"site-sidebar-layout":"default","site-content-layout":"","ast-site-content-layout":"default","site-content-style":"default","site-sidebar-style":"default","ast-global-header-display":"","ast-banner-title-visibility":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"","ast-breadcrumbs-content":"","ast-featured-img":"","footer-sml-layout":"","ast-disable-related-posts":"","theme-transparent-header-meta":"","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","astra-migrate-meta-layouts":"default","ast-page-background-enabled":"default","ast-page-background-meta":{"desktop":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"ast-content-background-meta":{"desktop":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2},"jetpack_post_was_ever_published":false},"categories":[1022,1046,1045],"tags":[],"class_list":["post-9440","post","type-post","status-publish","format-standard","hentry","category-web-architecture","category-nginx","category-webserver","psol-cat-web-architecture"],"jetpack_publicize_connections":[],"jetpack_shortlink":"https:\/\/wp.me\/phn2x7-2sg","jetpack_sharing_enabled":true,"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/posts\/9440","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/users\/508"}],"replies":[{"embeddable":true,"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/comments?post=9440"}],"version-history":[{"count":3,"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/posts\/9440\/revisions"}],"predecessor-version":[{"id":9451,"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/posts\/9440\/revisions\/9451"}],"wp:attachment":[{"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/media?parent=9440"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/categories?post=9440"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/tags?post=9440"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}