Skip to content
Grav 2.0 is officially stable. Read the announcement →

Community guidelines

Please keep discussions civil and on-topic. Repeated violations may lead to a temporary ban.

Support

403 response on Uri.params submit

Started by Medi Spiegelberg 4 years ago · 15 replies · 487 views
4 years ago

Dear Gravists !

I'm working on a website with a "stream" of the Project-Space Theme by @OleVik.
I like the theme a lot and find the clean URLs very helpful, especially when you can list the filtered categories in the address. This is super handy !

But unfortunately it's only working on the published website and not in local DDEV development. I'm super noob with NGINX... and I don't even know if the problem comes from there...

So basically when I click on "APPLY", nothing happens in the URL, the page reloads slightly (as in a fade effect), and I get the following error in the Mozilla dev console : 403 Forbidden

Does anybody have an idea of where I should dig and debug ?

Many thanks and have a nice day !
Medi

Here's a screen cap of the error :

Screenshot_2022-03-17_15-17-29|690x326

last edited 03/17/22 by Medi Spiegelberg
4 years ago

@medi, I've just installed the skeleton of Project-Space in a subdirectory of my localhost: http://localhost/grav/site-space. The home page (/projects) displays correctly, but when setting filters and running 'Apply' it throws an error in the console. It redirects to http://localhost/projects, which doesn't exist.

Also the urls in the menu on the right side of the page point to the root of the site: http://localhost

I'll happily leave the explanation to @OleVik ...

👍 1
4 years ago

Thanks @pamtbaau !
Actually now that you've tested it, (and specifically when you mention the "/project" redirection) I noticed that there's something to do with my website architecture.

I've commented out this in the tools.html.twig file, to see if it works manually :

TWIG
{% if system.home.alias == '/' ~ page.slug %}
  {% set action = base_url_absolute ~ '/' ~ page.slug %}
{% else %}
  {% set action = base_url_absolute ~ page.url %}
{% endif %}

And now I don't see any error !
But now I've got an other issue... the URL looks like it's making a "query" and not a "params" format. Like follows:

https://base.tld/**?category[]=Research&category[]=Sessions&redirect=true**

Thanks a lot for your hint !
Apparently the FILTER part doesn't recognize the format in the url. And I also want to make it look more readable.
I'm still looking for a way to make it work.

last edited 03/17/22 by Medi Spiegelberg
4 years ago

The URL-setup is for the quite generic variant of a server-setup, as you've noticed for the production-server. It's been a while since I ran DDEV, but what you're noticing in tools.html.twig#L33-37 is done to ensure that "the page reloads slightly (as in a fade effect)" - otherwise known as PJAX (pushState + AJAX) - as intended. Navigation does actually occur, but it is obscured through animations.

I gather, from your tests, that the theme works at the root of a domain, but not in a subfolder with NGINX? I can't see the same problem with LiteSpeed (Apache) in testing. Would you care to share more details of the NGINX/virtual host setups?

👍 1
4 years ago

@OleVik, When running the skeleton inside http://localhost/grav/project-space the theme doesn't function correctly.

  • The menu items point to the root of the domain (http://localhost/home, http://localhost/typography)
  • Running Apply throws an error in the console pjax.min.js:1 GET http://localhost/projects/category:Idea 404 (Not Found). Also because no relative urls is being used.

The theme words fine when running in the root of a domain.

4 years ago

And this is when ran within DDEV with NGINX?

4 years ago

@OleVik, Sorry, should have mentioned my environment:

  • Windows 10/WSL2 + Ubuntu-20.04 + Apache2

NB. The skeleton is based on Grav v1.6.25 and outdated plugins.

last edited 03/18/22 by pamtbaau
4 years ago

@OleVik:
Would you care to share more details of the NGINX/virtual host setups?

I'm sorry but I'm really a beginner in this topic. I'm just using the .conf file provided in the Grav package (by copying it to the Nginx-server folder of the ddev hidden folder). It's been working well for all the functionalities of Grav and basic theme manipulations. Basically 99% of my needs.

4 years ago

Indeed it is, I am in the process of updating it for 1.7-compliance. The issue may actually have arisen from how Core's API treats the generation of the Base URL. It's why tools.html.twig#L33-37 is needed, otherwise the theme is blissfully unaware of how to do the AJAXified redirects.

In other themes I'm fairly sure I have found workarounds, so it's possible here too. Just requires some time for testing alternatives.

4 years ago

@OleVik, Using the same upgraded skeleton and after replacing the theme with the beta:

4 years ago

I believe this may be resolved with beta.3, which further simplifies the logic used for location-handling.

4 years ago

@OleVik, No errors and selection seems to be working ok.

But don't chear yet... existing inheriting theme is now broken. Probably because of the added config property 'colors':

0 - An exception has been thrown during the rendering of a template ("Invalid argument supplied for foreach()").

4 years ago

Indeed, the loss backwards-compatibility with a major-version-bump. v2.0.0 proper includes fallbacks to empty arrays if categories, tags, or colors are not set.

4 years ago

@OleVik, v2.0.0 is working correctly.

Suggested topics

Topic Participants Replies Views Activity
Support · by Thomas, 1 week ago
3 94 3 hours ago
Support · by Anna, 3 days ago
2 94 24 hours ago
Support · by Justin Young, 1 day ago
1 64 1 day ago
Support · by Duc , 1 week ago
2 100 6 days ago
Support · by Colin Hume, 1 week ago
2 91 6 days ago