-
Notifications
You must be signed in to change notification settings - Fork 3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How can proxy_pass work with nginx_proxy without 301s on HTTP addresses? #1340
Comments
I still have not figured out how to do this... Maybe not possible with nginx. |
@jwilder I guess there's a more direct way I can ask: Is there any way to make your nginx proxy not forward HTTP -> HTTPS for a specific URL, only? |
This seems like confirmation it is not possible in this project: |
There's definitely no feature to do this intentionally, and I can't think of any way to cleanly workaround it. If I was in this situation, I might put my application behind another plain instance of nginx, so my application and an nginx instance are in the same |
Thanks for your reply... Just wanted to confirm it sounded difficult before spending a bunch more time on this. Running another instance of nginx on the same system sounds like something a bit beyond my nginx familiarity. Were you recommending to run it on the host system - and continue running nginx-proxy in docker? Just want to understand your recommendation. |
Hi @dm17, here's a working example that you can try: First, make a new directory and create these files:
Now make sure you have an You can use curl to make requests with the correct hostname, even though it's not in DNS:
As you can see, this request is being answered with a redirection to the HTTPS version of the site. The old URL you mentioned above, however, is not:
Hopefully this gets you to the point of being able to solve your problem! |
So a few years later, I can confirm the above works for this use case! The only additional thing I had to do was set the HTTPS_METHOD env variable to disable the nginx-proxy auto-redirect so that the intermediary nginx layer could handle it instead. Hope it helps for anyone else that stumbles upon this!
|
This, put into vhosts, is working fine if the specific old URL was HTTPS, but it is HTTP! I cannot use HTTPS_METHOD=noredirect disabling auto SSL for the entire VHOST! Is it possible just to disable it for the context of this custom nginx location? I can see in the nginx-proxy logs that it gets a 301 before it even hits this nginx customization. So unfortunately, I've only been able to get this proxy_pass config to work with HTTPS URLs, not HTTP.
Thanks for your help!
The text was updated successfully, but these errors were encountered: