forward 443 requests to correct (?) port

Brian Carey biscotty666 at gmail.com
Mon Sep 19 20:56:24 UTC 2022


It doesn't work if the originating url is https:// but does if it is 
http://

On 9/19/22 12:46, Eric Germann via nginx wrote:
> Do you have https: at the front of the URL instead of http:?
>
> ---
> Eric Germann
> ekgermann {at} semperen {dot} com || ekgermann {at} gmail {dot} com
> LinkedIn: https://www.linkedin.com/in/ericgermann
> Medium:https://ekgermann.medium.com
> Twitter: @ekgermann
> Telegram || Signal || Skype || Phone +1 {dash} 419 {dash} 513 {dash} 0712
>
> GPG Fingerprint:89ED 36B3 515A 211B 6390  60A9 E30D 9B9B 3EBF F1A1
>
>
>
>
>
>
>
>> On Sep 19, 2022, at 14:25, Brian Carey <biscotty666 at gmail.com> wrote:
>>
>> Hi,
>>
>> Maybe I'm misunderstanding how this should work. Can I use non-ssl 
>> connections for upstream servers when the originating request is https?
>>
>> I'm forwarding nginx requests to an apache server listening on 8080. 
>> Everything works fine if I explicitly use http but not https. My 
>> nginx site itself has no problem with https and all http traffic is 
>> forwarded to https. However when I try to go to wordpress (on apache) 
>> I get an error in my browser that I am forwarding plain http to 
>> https, and indeed the port I see in the browser is 443 not 8080. 
>> Again if I explicitly request http I'm good but it fails with https. 
>> Why is nginx forwarding this traffic to 443 instead of 8080? Or 
>> probably better how do I change this behavior?
>>
>> So I'm trying to find out how nginx makes that decision. This is the 
>> stanza nginx conf file.
>>
>> server {
>>         listen 80 default_server;
>>         listen [::]:80;
>>         server_name biscotty.me <http://biscotty.me>;
>>         return 301 https://$hostname$request_uri;
>> }
>>
>> server{
>>
>>  listen 443 ssl http2;
>>         listen [::]:443 ssl;
>>         server_name biscotty.me <http://biscotty.me>;
>>
>>         ssl_certificate /etc/nginx/ssl/certificates.crt;
>>         ssl_certificate_key /etc/nginx/ssl/private.key;
>>
>>         root /var/www/html;
>>
>>         index index.html index.htm index.nginx-debian.html;
>>
>>         server_name _;
>>
>>         location / {
>>                 # First attempt to serve request as file, then
>>                 # as directory, then fall back to displaying a 404.
>>                 try_files $uri $uri/ =404;
>>         }
>>
>> location /wordpress {
>>                 proxy_pass http://0.0.0.0:8080;
>>                 proxy_buffering on;
>>                 proxy_buffers 12 12k;
>>                 proxy_redirect off;
>>
>>                 proxy_set_header X-Real-IP $remote_addr;
>>                 proxy_set_header X-Forwarded-For $remote_addr;
>>                 proxy_set_header Host $host:8080;
>>         }
>>
>> }
>>
>> _______________________________________________
>> nginx mailing list -- nginx at nginx.org
>> To unsubscribe send an email to nginx-leave at nginx.org
>
>
> _______________________________________________
> nginx mailing list --nginx at nginx.org
> To unsubscribe send an email tonginx-leave at nginx.org
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.nginx.org/pipermail/nginx/attachments/20220919/7078fa62/attachment.htm>


More information about the nginx mailing list