Welcome! Log In Create A New Profile

Advanced

listen to https redirect to other page not working

Christian Rocholl
May 09, 2023 08:52AM
Hi guys,
I am having a jpro.one parsed javafx webpage/app hosted by an nginx
server. It is accessible via http://DOMAIN:8080. This is working as
intended.

Now I have configured nginx so that it listens on port 80 and 443, so that,
http://DOMAINNAME -> return https://DOMAINNAME and https://DOMAINNAME ->
return http://localhost:8080, which I want to do.

When I enter http://DOMAINNAME:8080, the page works as intended.

When I enter https://DOMAINNAME:8080, I get a warning about a bad
certificate, since jpro returns http content, so I suppose it is working as
intended. Additional question: Is there a way to get rid of the cert
warning?

When I enter http://DOMAINNAME I get redirected to the https page, so
working as intended.

BUT: When I enter https://DOMAINNAME, it just says the page is not
available. I expected to get redirected to http://localhost:8080.

My nginx config, checked with nginx -t, is syntax correct but fails to
redirect me on https access. These are my nginx config files in
/etc/nginx/conf.d/ I tried:

- jpro.conf:
```
proxy_buffering off;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_read_timeout 86400;
proxy_http_version 1.1;
```
and -DOMAIN.conf
```
upstream ppcsc {
server localhost:8080;
}
server {
listen 80;
server_name DOMAINNAME;
return 301 https://$http_host$request_uri;
}
server {
listen 443 ssl;
server_name DOMAINNAME;
tcp_nodelay on;
ssl_certificate FILE.cer;
ssl_certificate_key FILE.key;
ssl_protocols TLSv1.3;
ssl_ciphers HIGH:!aNULL:!MD5;
# return 301 http://ppcsc;
return 301 http://$http_host:8080$request_uri;
# location / { # proxy_pass http://ppcsc; # } }
```
Thanks for the help and kind regards , Chris
_______________________________________________
nginx mailing list
nginx@nginx.org
https://mailman.nginx.org/mailman/listinfo/nginx
Subject Author Posted

listen to https redirect to other page not working

Christian Rocholl May 09, 2023 08:52AM

Re: listen to https redirect to other page not working

Sergey A. Osokin May 09, 2023 10:00AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 237
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready