#Unauthenticated Paths Regex not working

1 messages · Page 1 of 1 (latest)

vagrant coral
#

I'm struggeling with the regex for the unauthenticated paths. I use the application Gitea en want to be able to Push and Pull over https. I used the following regex:
^(.)/info/refs?service=(.)$

The URL that is used for the push or pull is something like https://git.domain.com/repo/title/info/refs?=service=git-upload-pack

Can someone help with the correct regex as i still get a redirect 302 when push or pull in Visual Studio Code?

wintry junco
#

Backslash your forward slashes and backslash the question mark. Your beginning of the url also doesn't look right. You might have wanted .* instead of just .

This person also had issues but solved by just using the url location after the domain and the backslash for the forward slashes.
#1079573649138384926 message

vagrant coral
#

Thanks i will try that

eternal pivot
#

Also when posting code use single or triple backticks around it, so when you do put * in what you paste, people see that and not the text changed to italics

#

Which I think has happened above

vagrant coral
#

That is indeed what happend. The code i used is ^(.*)/info/refs\?service=(.*)$

#

I tried several ways and they al gave a 302 response

.*\/refs\?service=(.*)$

wintry junco
#

maybe try something simpler?

#

.*\/refs.*service=.*

#

and I'm not sure if the proxy outpost does any type of caching btw, so it wouldnt hurt to restart the proxy outpost and force some type of resync

#

If anything try and get it working with the simplest regex possible and then expand outward for troubleshooting reasons.

#

so .*refs.* and then .*\/refs.* to make sure any assumptions we're making a accurately doing what we expect (which I know is never fun but its better then banging your head against the same syntax)

vagrant coral
#

Thanks for the examples. I now have it working with .*info\/refs.*. I think the question mark is the issue in the regex. When i try something like .*info\/refs\?service=.* or .*info\/refs\?service.* it fails again.

wintry junco
#

Well I wanted you backslash the question mark because it's used to say none or one of the preceding item. You might need a double backslash?

vagrant coral
#

I will try that this evening, will let you know

vagrant coral
#

I tried several regex variations but everything behind the question mark seems to be ignored.

For now i added 3 regexes as the url changes when performing a git pull. For now everything works perfect

#

Thanks for your help!

heavy basin
# vagrant coral Thanks for your help!

Hi guyke01, would it be possible to post your solution (the 3 regexes you use now), because I am struggling with the same problem and it might lead me to the right way...
Thanks in advance!

vagrant coral
#

Hi Emile, sure, i've using the following regexes right now:
.*info\/refs.*
.*git-receive-pack$
.*git-upload-pack$

At first i've only used the first line, but when i did a pull the error came back. When i checked the Nginx logs i saw that URL was changing and therefore i needed the other 2 regexes

heavy basin
# vagrant coral Hi Emile, sure, i've using the following regexes right now: `.*info\/refs.*` `.*...

Hey guyke01, thanks for helping! I will try if this ones also work with gogs.
Unfortunately my other problem is not solved yet. I see you worked around the question mark in the url with the .* at the end. I also have the feeling everything after a question mark in a url is not being matched to the regex. As I have a url that starts with a question mark directly after the host.domain part, I think it will never work 😫.

vagrant coral
heavy basin
vagrant coral
#

No problem at all, hope they fix that issue 😁