Why disable CORS directive can not be saved in vhost file?

Discussion in 'Installation/Configuration' started by skysky, Aug 10, 2022.

  1. skysky

    skysky Member

    HI
    I put below codes in the nginx Directives setting, and clicked save. after ispconfig finished applying the changes, I open the nginx Directives setting again, and see the below codes there. but open the vhost file of that website, the codes are not there.

    more_set_headers 'Access-Control-Allow-Origin: *';
    more_set_headers 'Access-Control-Allow-Methods: GET, POST, OPTIONS';
    more_set_headers 'Access-Control-Allow-Headers: DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type';

    if manually put the codes into vhost, it works. but ispconfig will remove the codes after saving changes.
     

    Attached Files:

    Last edited: Aug 10, 2022
  2. till

    till Super Moderator Staff Member ISPConfig Developer

    Rename the .vhost file to vhost.bak, then rename the vhost.err file to .vhost, restart nginx and check the log to see why nginx fails to start.
     
  3. skysky

    skysky Member

    No, you misunderstood my question. Nginx is running fine.
    the issue here is ISPconfig can not save the code below I saved in nginx Directives. the vhost file has no that codes after saved.

    more_set_headers 'Access-Control-Allow-Origin: *';
    more_set_headers 'Access-Control-Allow-Methods: GET, POST, OPTIONS';
    more_set_headers 'Access-Control-Allow-Headers: DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type';
     
  4. till

    till Super Moderator Staff Member ISPConfig Developer

    So you are not interested to find out why ISPConfig is not saving the changes? But why do you post here then if you do not want to know why changes are not saved?
     
  5. skysky

    skysky Member

    I don't know why, but I put the codes into nginx.conf http section to make it working instead.
    thanks
     
  6. Taleman

    Taleman Well-Known Member HowtoForge Supporter

    Is there a file in the vhost file directory with name ending in ".err"? If there is, ISPConfig renamed the vhost file to that, so you do not see the changes you made in the vhost file.
    @till suggested a way to find out why nginx did not start with the changes, making ISPConfig do the renaming to make nginx start.
     
  7. skysky

    skysky Member

    Is there a file in the vhost file directory with name ending in ".err"?
    NO
     
  8. till

    till Super Moderator Staff Member ISPConfig Developer

Share This Page