# Error when setting up HTTPS protocol

**URL:** <https://community.sonatype.com/t/error-when-setting-up-https-protocol/9986>\
**Category:** Sonatype Nexus Repository\
**Tags:** nexus-repository\
**Created:** [January 22, 2023, 2:42pm UTC](https://community.sonatype.com/t/error-when-setting-up-https-protocol/9986 "2023-01-22T14:42:01Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![icemerpro](https://yyz1.discourse-cdn.com/flex047/user_avatar/community.sonatype.com/icemerpro/32/2563_2.png) [@icemerpro](https://community.sonatype.com/u/icemerpro)\
**Post date:** [January 22, 2023, 2:42pm UTC](https://community.sonatype.com/t/error-when-setting-up-https-protocol/9986/1 "2023-01-22T14:42:02Z")

</div>

Hello !

I’m struggling with the setup of the HTTPS protocol for the repository manager.  
I’ve correctly installed and configured nginx to use the 443 port and to send requests to the website :

```auto
server {
    listen 443 ssl;
    server_name hereismydomain;
    ssl_certificate /etc/letsencrypt/live/hereismydomain/fullchain.pem;
    ssl_certificate_key /etc/letsencrypt/live/hereismydomain/privkey.pem;
    ssl_protocols TLSv1.2;
    ssl_ciphers HIGH:!aNULL:!MD5;

    location / {
        proxy_pass http://127.0.0.1:8081;
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    }
}

```

The website works now with https, but the repositories URLs still are with “http”. This prevents me from getting any code from the nexus with Maven (since http protocol is not supported anymore by Maven from the 3.8.1 version, and I cannot downgrade Maven’s version).

I followed the tutorial to setup HTTPS : I first set `application-ssl-port=443` in the nexus.properties file. I then uncommented the line nexus-args and added the argument `${jetty.etc}/jetty-https.xml`. But when I restart with these parameters, I get this error :

```auto
java.lang.NoSuchMethodException: class org.eclipse.jetty.server.HttpConfiguration.setSecurePort(class java.lang.Object). Found setters for int
Jan 22 15:08:21 myname nexus[10470]: at org.eclipse.jetty.xml.XmlConfiguration$JettyXmlConfiguration.set(XmlConfiguration.java:742)
Jan 22 15:08:21 myname nexus[10470]: at org.eclipse.jetty.xml.XmlConfiguration$JettyXmlConfiguration.configure(XmlConfiguration.java:509)
Jan 22 15:08:21 myname nexus[10470]: at org.eclipse.jetty.xml.XmlConfiguration$JettyXmlConfiguration.refObj(XmlConfiguration.java:1063)
Jan 22 15:08:21 myname nexus[10470]: at org.eclipse.jetty.xml.XmlConfiguration$JettyXmlConfiguration.configure(XmlConfiguration.java:530)
Jan 22 15:08:21 myname nexus[10470]: at org.eclipse.jetty.xml.XmlConfiguration$JettyXmlConfiguration.configure(XmlConfiguration.java:468)
Jan 22 15:08:21 myname nexus[10470]: at org.eclipse.jetty.xml.XmlConfiguration.configure(XmlConfiguration.java:380)
Jan 22 15:08:21 myname nexus[10470]: at org.sonatype.nexus.bootstrap.jetty.JettyServer.doStart(JettyServer.java:168)
Jan 22 15:08:21 myname nexus[10470]: at org.sonatype.nexus.bootstrap.jetty.JettyServer.lambda$0(JettyServer.java:117)
Jan 22 15:08:21 myname nexus[10470]: at java.security.AccessController.doPrivileged(Native Method)
Jan 22 15:08:21 myname nexus[10470]: at org.sonatype.nexus.bootstrap.jetty.JettyServer.start(JettyServer.java:115)
Jan 22 15:08:21 myname nexus[10470]: at org.sonatype.nexus.bootstrap.Launcher.start(Launcher.java:131)
Jan 22 15:08:21 myname nexus[10470]: at org.sonatype.nexus.bootstrap.Launcher.startAsync(Launcher.java:127)
Jan 22 15:08:21 myname nexus[10470]: at org.sonatype.nexus.bootstrap.osgi.LauncherActivator.start(LauncherActivator.java:67)
Jan 22 15:08:21 myname nexus[10470]: at org.apache.felix.framework.util.SecureAction.startActivator(SecureAction.java:698)
Jan 22 15:08:21 myname nexus[10470]: at org.apache.felix.framework.Felix.activateBundle(Felix.java:2402)
Jan 22 15:08:21 myname nexus[10470]: at org.apache.felix.framework.Felix.startBundle(Felix.java:2308)
Jan 22 15:08:21 myname nexus[10470]: at org.apache.felix.framework.Felix.setActiveStartLevel(Felix.java:1539)
Jan 22 15:08:21 myname nexus[10470]: at org.apache.felix.framework.FrameworkStartLevelImpl.run(FrameworkStartLevelImpl.java:308)
Jan 22 15:08:21 myname nexus[10470]: at java.lang.Thread.run(Thread.java:750)
Jan 22 15:08:21 myname nexus[10470]: Suppressed: java.lang.NoSuchMethodException: org.eclipse.jetty.server.HttpConfiguration.setSecurePort(java.lang.Object)
Jan 22 15:08:21 myname nexus[10470]: at java.lang.Class.getMethod(Class.java:1786)
Jan 22 15:08:21 myname nexus[10470]: at org.eclipse.jetty.xml.XmlConfiguration$JettyXmlConfiguration.set(XmlConfiguration.java:601)
Jan 22 15:08:21 myname nexus[10470]: ... 18 common frames omitted
Jan 22 15:08:21 myname nexus[10470]: Suppressed: java.lang.NoSuchFieldException: TYPE
Jan 22 15:08:21 myname nexus[10470]: at java.lang.Class.getField(Class.java:1703)
Jan 22 15:08:21 myname nexus[10470]: at org.eclipse.jetty.xml.XmlConfiguration$JettyXmlConfiguration.set(XmlConfiguration.java:614)
Jan 22 15:08:21 myname nexus[10470]: ... 18 common frames omitted
Jan 22 15:08:21 myname nexus[10470]: Suppressed: java.lang.NoSuchFieldException: securePort
Jan 22 15:08:21 myname nexus[10470]: at java.lang.Class.getField(Class.java:1703)
Jan 22 15:08:21 myname nexus[10470]: at org.eclipse.jetty.xml.XmlConfiguration$JettyXmlConfiguration.set(XmlConfiguration.java:629)
Jan 22 15:08:21 myname nexus[10470]: ... 18 common frames omitted
Jan 22 15:08:21 myname nexus[10470]: Suppressed: java.lang.IllegalArgumentException: null
Jan 22 15:08:21 myname nexus[10470]: at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
Jan 22 15:08:21 myname nexus[10470]: at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
Jan 22 15:08:21 myname nexus[10470]: at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
Jan 22 15:08:21 myname nexus[10470]: at java.lang.reflect.Method.invoke(Method.java:498)
Jan 22 15:08:21 myname nexus[10470]: at org.eclipse.jetty.xml.XmlConfiguration$JettyXmlConfiguration.invokeMethod(XmlConfiguration.java:765)
Jan 22 15:08:21 myname nexus[10470]: at org.eclipse.jetty.xml.XmlConfiguration$JettyXmlConfiguration.set(XmlConfiguration.java:679)
Jan 22 15:08:21 myname nexus[10470]: ... 18 common frames omitted
Jan 22 15:08:21 myname nexus[10470]: Suppressed: java.lang.NoSuchMethodException: java.lang.Integer.<init>(java.lang.Object)
Jan 22 15:08:21 myname nexus[10470]: at java.lang.Class.getConstructor0(Class.java:3082)
Jan 22 15:08:21 myname nexus[10470]: at java.lang.Class.getConstructor(Class.java:1825)
Jan 22 15:08:21 myname nexus[10470]: at org.eclipse.jetty.xml.XmlConfiguration$JettyXmlConfiguration.set(XmlConfiguration.java:725)
Jan 22 15:08:21 myname nexus[10470]: ... 18 common frames omitted

```

My nexus.properties file is :

```auto
nexus-args=${jetty.etc}/jetty.xml,${jetty.etc}/jetty-http.xml,${jetty.etc}/jetty-https.xml,${jetty.etc}/jetty-requestlog.xml
application-ssl-port=443

```

My nexus-default.properties file :

```auto
## DO NOT EDIT - CUSTOMIZATIONS BELONG IN $data-dir/etc/nexus.properties
##
# Jetty section
application-port=8081
application-host=0.0.0.0
nexus-args=${jetty.etc}/jetty.xml,${jetty.etc}/jetty-http.xml,${jetty.etc}/jetty-requestlog.xml
nexus-context-path=/

# Nexus section
nexus-edition=nexus-pro-edition
nexus-features=\
 nexus-pro-feature

nexus.hazelcast.discovery.isEnabled=true

```

I’ve got the problem with two versions : the latest one (3.45) and the 3.41 version.

Does anybody know how to fix this ?  
Regards,

---

<div class="post-metadata">

**Author:** ![abdelillah.asraoui](https://avatars.discourse-cdn.com/v4/letter/a/9fc348/32.png) [@abdelillah.asraoui](https://community.sonatype.com/u/abdelillah.asraoui)\
**Post date:** [January 23, 2023, 2:58am UTC](https://community.sonatype.com/t/error-when-setting-up-https-protocol/9986/2 "2023-01-23T02:58:24Z")

</div>

> [@icemerpro](#):
>
> nexus-default.properties

In the nexus.properties you want to remove jetty-http.xml and keep jetty-https.xml.  
and also add application-ssl-port=443 in nexus.properties  
check if the nexus service is running: service network status cli …

-abdel

---

<div class="post-metadata">

**Author:** ![mpiggott](https://avatars.discourse-cdn.com/v4/letter/m/f0a364/32.png) [@mpiggott](https://community.sonatype.com/u/mpiggott)\
**Post date:** [January 23, 2023, 4:18pm UTC](https://community.sonatype.com/t/error-when-setting-up-https-protocol/9986/3 "2023-01-23T16:18:38Z")

</div>

I’m not sure what you mean by your repository URLs are http.

Configuring jetty for https probably isn’t necessary if you’re configuring nginx as a reverse proxy.

---

<div class="post-metadata">

**Author:** ![icemerpro](https://yyz1.discourse-cdn.com/flex047/user_avatar/community.sonatype.com/icemerpro/32/2563_2.png) [@icemerpro](https://community.sonatype.com/u/icemerpro)\
**Post date:** [January 23, 2023, 6:49pm UTC](https://community.sonatype.com/t/error-when-setting-up-https-protocol/9986/4 "2023-01-23T18:49:40Z")

</div>

(I reinstalled the nexus in order to get rid of the error that was showing up on nexus boot, in the aim for the panel to start.)

Even though the panel works great and the website shows as “https”, repositories urls show up as “http” and thus Maven can’t reach the Nexus when I setup the proxy as HTTPS in the settings.xml file (if I setup the proxy as http, I can deploy but not get anything since Maven does not support http proxies since the 3.8.1 version) hence I can’t download anything from it.

 ![image](https://canada1.discourse-cdn.com/flex047/uploads/communitysonatype/original/2X/0/000340acc6cd58de81c3bc11c1a99929516d7d37.png)

That’s my settings.xml file with the proxy in https :

```auto
<proxy>
		  <id>myproxy</id>
		  <active>true</active>
		  <protocol>https</protocol>
		  <username>admin</username>
		  <password>mypassword</password>
		  <host>hereismyip</host> 
		  <port>8081</port>         
</proxy>  

```

NB : I also tried to set the port “443” (as it is my https port), same error occurs.

I get this error when trying to deploy/get something with these settings with Maven : `Connection timed out: connect`.  
The website works perfectly fine. The link I provided for the deploy is valid (this is a https link).

---

<div class="post-metadata">

**Author:** ![icemerpro](https://yyz1.discourse-cdn.com/flex047/user_avatar/community.sonatype.com/icemerpro/32/2563_2.png) [@icemerpro](https://community.sonatype.com/u/icemerpro)\
**Post date:** [January 23, 2023, 6:50pm UTC](https://community.sonatype.com/t/error-when-setting-up-https-protocol/9986/5 "2023-01-23T18:50:17Z")

</div>

Thanks for your kind reply. Unfortunately, the clues that you’ve given me didn’t work.

---

<div class="post-metadata">

**Author:** ![mpiggott](https://avatars.discourse-cdn.com/v4/letter/m/f0a364/32.png) [@mpiggott](https://community.sonatype.com/u/mpiggott)\
**Post date:** [January 23, 2023, 9:32pm UTC](https://community.sonatype.com/t/error-when-setting-up-https-protocol/9986/6 "2023-01-23T21:32:28Z")

</div>

Nexus will show the URLs based on the URL you used to access the UI.

---

<div class="post-metadata">

**Author:** ![icemerpro](https://yyz1.discourse-cdn.com/flex047/user_avatar/community.sonatype.com/icemerpro/32/2563_2.png) [@icemerpro](https://community.sonatype.com/u/icemerpro)\
**Post date:** [January 24, 2023, 7:23pm UTC](https://community.sonatype.com/t/error-when-setting-up-https-protocol/9986/7 "2023-01-24T19:23:31Z")

</div>

When I visit my website the URL shows with “https”. However, the repositories URLs still remain in http. But that’s not my point : I literally can’t get anything from the nexus with Maven when the protocol is set as https (it gives me an error, I pasted it in my last message). I just can’t figure how to make this work.

---

<div class="post-metadata">

**Author:** ![rseddon](https://yyz1.discourse-cdn.com/flex047/user_avatar/community.sonatype.com/rseddon/32/341_2.png) [@rseddon](https://community.sonatype.com/u/rseddon)\
**Post date:** [January 24, 2023, 9:58pm UTC](https://community.sonatype.com/t/error-when-setting-up-https-protocol/9986/8 "2023-01-24T21:58:13Z")

</div>

Usually the symptoms you are describing occur when a reverse proxy/load balancer is running in front of Nexus Repo. If that isn’t setting the X-Forwarded-Proto header correctly outbound URL’s such as repository URL’s will show as http, rather than https. If you do have something running in front of Nexus Repo check its configuration. See here for examples:

[https://help.sonatype.com/repomanager3/planning-your-implementation/run-behind-a-reverse-proxy#RunBehindaReverseProxy-Example:ReverseProxySSLTerminationatBasePath](https://help.sonatype.com/repomanager3/planning-your-implementation/run-behind-a-reverse-proxy#RunBehindaReverseProxy-Example:ReverseProxySSLTerminationatBasePath)

---

<div class="post-metadata">

**Author:** ![icemerpro](https://yyz1.discourse-cdn.com/flex047/user_avatar/community.sonatype.com/icemerpro/32/2563_2.png) [@icemerpro](https://community.sonatype.com/u/icemerpro)\
**Post date:** [January 25, 2023, 6:22pm UTC](https://community.sonatype.com/t/error-when-setting-up-https-protocol/9986/9 "2023-01-25T18:22:36Z")

</div>

Thanks for your precious help, it solved my problem.
