Welcome! Log In Create A New Profile


location block with regular expression redirect to static site

Posted by rami.ammar 
location block with regular expression redirect to static site
January 14, 2021 09:35AM

I have a problem with my nginx instance. I want to disactivate cache control in only html and json pages.
Il my server configuration I have this:

server {
listen 443 ssl;
server_name myservername.com;
root /var/www/html/myapp;
location /back/ {
proxy_pass http://localhost:8082/;

location /inscription {
rewrite ^/inscription(.*)$ https://forms.gle/NRYg4QUDu4oqNYRd9 redirect;

location ~* \.(json|html)$ {
add_header Cache-Control "no-cache,no-store";
etag off;

# ssl conf
# log conf

The cache control works but I have a swagger activated in my back and when I solicit swagger I have 404 page. In log I notice that le swagger request is rediriged to static site instead of being redirected to the back.
How I implement Cache control for all html and static pages without infect the redirect by location?

Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 127
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 500 on July 15, 2024
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready