-
Notifications
You must be signed in to change notification settings - Fork 10
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
Can't change hardcoded port 8080 #9
Comments
You'll want to forward to port 8080 inside Docker, rather than port 80. The Nginx config inside the Docker container exposes two ports: 80 and 8080. Port 80 is just there to forward to SSL/443 (i.e., you want to serve exclusively HTTPS content, and as a convenience, auto redirect people who hit the HTTP endpoint). In your case, I believe you just want to forward the HTTP app (8080). So the following config I think should be what you want.
|
Nope [root@openrepo openrepo]# cat docker-compose.yml | grep ports -A 1
ports:
- "80:8080"
[root@openrepo openrepo]# curl -v http://openrepo.opentech.local/infra-el8
* Trying 127.0.0.1...
* TCP_NODELAY set
* Connected to openrepo.opentech.local (127.0.0.1) port 80 (#0)
> GET /infra-el8 HTTP/1.1
> Host: openrepo.opentech.local
> User-Agent: curl/7.61.1
> Accept: */*
>
< HTTP/1.1 301 Moved Permanently
< Server: nginx/1.18.0 (Ubuntu)
< Date: Fri, 12 May 2023 16:37:02 GMT
< Content-Type: text/html
< Content-Length: 178
< Location: http://openrepo.opentech.local:8080/infra-el8/ <------ the same
< Connection: keep-alive
<
<html>
<head><title>301 Moved Permanently</title></head>
<body>
<center><h1>301 Moved Permanently</h1></center>
<hr><center>nginx/1.18.0 (Ubuntu)</center>
</body>
</html>
* Connection #0 to host openrepo.opentech.local left intact |
To be clear, the "repo" is only one page who acts like this. The OpenRepo web interface & API works as expected |
I tested and it works fine for me. One caveat seems to be that you need to upload a single package file to the repo. Before a RPM/Deb or generic file is uploaded, the repo directory doesn't yet exist and Nginx will return a 404. I wonder if your docker images didn't get recreated when you ran docker-compose? From your command output, that port (8080) shouldn't even be open if you made the changes I posted. Here is the full docker-compose.yml file I'm using for reference:
|
Yes, it is
I'm removed all Check that packages exists: [root@openrepo openrepo]# curl http://openrepo.opentech.local/infra-el8/
<html>
<head><title>Index of /infra-el8/</title></head>
<body>
<h1>Index of /infra-el8/</h1><hr><pre><a href="../">../</a>
<a href="repodata/">repodata/</a> 19-May-2023 08:34 -
<a href="ethq-0.6.2-1.el8.x86_64.rpm">ethq-0.6.2-1.el8.x86_64.rpm</a> 19-May-2023 08:25 71292
<a href="public.gpg">public.gpg</a> 19-May-2023 08:34 1648
<a href="sst-1.7.237-1.el8.x86_64.rpm">sst-1.7.237-1.el8.x86_64.rpm</a> 19-May-2023 08:34 57348328
</pre><hr></body>
</html> Then check for original issue (same request without trailing slash): [root@openrepo openrepo]# curl -Ss -v http://openrepo.opentech.local/infra-el8 | grep Location
* Trying 127.0.0.1...
* TCP_NODELAY set
* Connected to openrepo.opentech.local (127.0.0.1) port 80 (#0)
> GET /infra-el8 HTTP/1.1
> Host: openrepo.opentech.local
> User-Agent: curl/7.61.1
> Accept: */*
>
< HTTP/1.1 301 Moved Permanently
< Server: nginx/1.18.0 (Ubuntu)
< Date: Fri, 19 May 2023 09:00:03 GMT
< Content-Type: text/html
< Content-Length: 178
< Location: http://openrepo.opentech.local:8080/infra-el8/ <--------- port still present
< Connection: keep-alive
<
{ [178 bytes data]
* Connection #0 to host openrepo.opentech.local left intact |
I apologize, maybe I'm misunderstanding. Are you saying that this URL works: But this URL provides a redirect: The bug here being the reference to port 8080 instead of redirecting to: http://openrepo.opentech.local/infra-el8/ is that right? |
Exactly!
|
I pushed a change (commit c43f638) that hopefully resolves that issue. You can test it by either rebuilding the docker image and redeploying, or you can manually replace the config in your Nginx container and run:
|
Hi, I was modify docker-compose to expose port 80
But when I'm try to curl repo without trailing slash, OpenRepo return url with port number
I was try to resolve this via definition env
OPENREPO_DOMAIN
to host:80 - seems this option isn't working for this case as wellThe text was updated successfully, but these errors were encountered: