niccokunzmann / open-web-calendar

Embed a highly customizable web calendar into your website using ICal source links
https://open-web-calendar.quelltext.eu
GNU General Public License v2.0
215 stars 70 forks source link

Fix : allow use of subfolders in the url with reverse proxies #454

Open anthonymasset opened 3 months ago

anthonymasset commented 3 months ago

This fix allow to use owc behind a reverse proxy using a subfolder in the url. Ex : https://www.domain.fr/owc/

The index page generates all the paths correctly. t also works with urls without subfolders. Ex : https://owc.domain.fr

niccokunzmann commented 3 months ago

Thanks for your fix! The tests show that the about page has a problem.. Could you check that we can visit the about page and also the about page works? The code should work with /index.html and / as well as /about.html and /calendar.html.

I think what you would like to achieve is to add everything before the first / to the DEFAULT_URL - is that what you would like to do?

anthonymasset commented 3 months ago

It should be ok now. The pytest fail because of the url tested that is absolute in place of relative. If I modify that on my computer, the test pass.

niccokunzmann commented 3 months ago

Thanks, this looks much more like it adresses the scale of the change - relative links! I found that the tests fail because some absolute links are tested for. Here is an example:

link = f'<link rel="alternate" type="text/calendar" href="/calendar.ics?{html.escape(query)}" />'
niccokunzmann commented 3 months ago

It looks alright and we can merge when twe tests pass, I think.

niccokunzmann commented 1 month ago

Hi, can I help you with anything for this PR?