All links must be relative #13

Open
opened 6 months ago by ano · 6 comments
ano commented 6 months ago

When I use gitea with reverse proxy there is wrong links to images if you use $scheme://$host:$port/$uri
Why not to use only /$uri links on pages?
(example patch attached)

When I use gitea with reverse proxy there is wrong links to images if you use $scheme://$host:$port/$uri Why not to use only /$uri links on pages? (example patch attached)
Owner

The URL presented should always be the one requested by your browser, not matter if mvoci is behind a reverse proxy or not. But maybe I don't quite understand the problem.

Presenting only relative links to the state-banners would require the user to add the protocol, host and ports to the URL, wouldn't it? I'm not sure if that would be better or not.

The URL presented should always be the one requested by your browser, not matter if mvoci is behind a reverse proxy or not. But maybe I don't quite understand the problem. Presenting only relative links to the state-banners would require the user to add the protocol, host and ports to the URL, wouldn't it? I'm not sure if that would be better or not.
Poster

I have nginx as a proxy:

server {
        server_name     mvo.site.ru;
        listen          4042 ssl;

        ssl_stapling            off;
        ssl_protocols           TLSv1 TLSv1.1 TLSv1.2 TLSv1.3;
        ssl_certificate         mvo.crt;
        ssl_certificate_key     mvo.key;
        ssl_session_timeout     1h;
        ssl_session_cache       shared:SSL:16m;
        ssl_ciphers             EECDH:+AES256:-3DES:RSA+AES:RSA+3DES:!NULL:!RC4;
        ssl_prefer_server_ciphers       on;

        error_log       /var/log/nginx/error-mvo.log    error;

        location / {
                proxy_pass      http://incubator:4042;
                proxy_redirect  default;
        }
}

mvoCI is on the server without public IP. When I make request to
https://mvo.site.ru:4042/repo/view/555
I get a page with

<img src="http://incubator:4042/repo/state/5">
...
<input type="hidden" id="state_url" value="http://incubator:4042/repo/state/5">

instead of

<img src="/repo/state/5">
...
<input type="hidden" id="state_url" value="/repo/state/5">

And of course I don't see status image.

I have nginx as a proxy: ``` server { server_name mvo.site.ru; listen 4042 ssl; ssl_stapling off; ssl_protocols TLSv1 TLSv1.1 TLSv1.2 TLSv1.3; ssl_certificate mvo.crt; ssl_certificate_key mvo.key; ssl_session_timeout 1h; ssl_session_cache shared:SSL:16m; ssl_ciphers EECDH:+AES256:-3DES:RSA+AES:RSA+3DES:!NULL:!RC4; ssl_prefer_server_ciphers on; error_log /var/log/nginx/error-mvo.log error; location / { proxy_pass http://incubator:4042; proxy_redirect default; } } ``` mvoCI is on the server without public IP. When I make request to https://mvo.site.ru:4042/repo/view/555 I get a page with ``` <img src="http://incubator:4042/repo/state/5"> ... <input type="hidden" id="state_url" value="http://incubator:4042/repo/state/5"> ``` instead of ``` <img src="/repo/state/5"> ... <input type="hidden" id="state_url" value="/repo/state/5"> ``` And of course I don't see status image.
Owner

Ok. I see. Relative links solve the not visible images-problem, however they don't really solve broken links. You probably see a broken URL on the integration page as well, don't you?

In Apache I set ProxyPreserverHost on, which preserves the requested host when relaying the http requests to mvoCI. I'm unsure how that config would look on nginx.

Edit: nevertheless, I will have a look into the relative image url thing.

Ok. I see. Relative links solve the not visible images-problem, however they don't really solve broken links. You probably see a broken URL on the integration page as well, don't you? In Apache I set `ProxyPreserverHost on`, which preserves the requested host when relaying the http requests to mvoCI. I'm unsure how that config would look on nginx. Edit: nevertheless, I will have a look into the relative image url thing.
Poster

nginx can rewrite headers by proxy_set_header but how to deal with scheme (http/https)? I don't need https in local net.

nginx can rewrite headers by ```proxy_set_header``` but how to deal with scheme (http/https)? I don't need https in local net.
Poster

Just wild thing: use relative links and make URL from URI in copyToClipboard JS function. Pros? Cons?

Just wild thing: use relative links and make URL from URI in copyToClipboard JS function. Pros? Cons?

Just wild thing: use relative links and make URL from URI in copyToClipboard JS function. Pros? Cons?

This would make for the most coherent experience, in my opinion.

> Just wild thing: use relative links and make URL from URI in copyToClipboard JS function. Pros? Cons? This would make for the most coherent experience, in my opinion.
Sign in to join this conversation.
Loading…
There is no content yet.